2016-04-19 03:20:07 +00:00
|
|
|
---
|
|
|
|
# Copyright 2016, Rackspace US, Inc.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
## APT Cache Options
|
|
|
|
cache_timeout: 600
|
|
|
|
|
|
|
|
# Required apt packages.
|
2016-08-30 15:13:18 +00:00
|
|
|
lxc_hosts_distro_packages:
|
2016-04-19 03:20:07 +00:00
|
|
|
- apparmor
|
|
|
|
- apparmor-utils
|
2017-08-14 15:08:29 +00:00
|
|
|
- aria2
|
2016-04-19 03:20:07 +00:00
|
|
|
- bridge-utils
|
2017-04-06 17:24:07 +00:00
|
|
|
- btrfs-tools
|
2016-04-19 03:20:07 +00:00
|
|
|
- cgmanager
|
|
|
|
- cgroup-lite
|
2017-04-06 17:24:07 +00:00
|
|
|
- dbus
|
2016-04-19 03:20:07 +00:00
|
|
|
- debootstrap
|
2017-08-16 13:43:45 +00:00
|
|
|
- dnsmasq-base
|
2016-04-19 03:20:07 +00:00
|
|
|
- git
|
2016-06-02 20:30:41 +00:00
|
|
|
- iptables
|
2016-04-19 03:20:07 +00:00
|
|
|
- irqbalance
|
|
|
|
- language-pack-en
|
|
|
|
- liblxc1
|
|
|
|
- lxc
|
|
|
|
- lxc-dev
|
|
|
|
- lxc-templates
|
|
|
|
- python-dev
|
|
|
|
- python3-lxc
|
2017-04-06 17:24:07 +00:00
|
|
|
- systemd-container
|
2016-04-19 03:20:07 +00:00
|
|
|
- pxz
|
|
|
|
|
2017-08-16 13:43:45 +00:00
|
|
|
# Package to remove from the host
|
|
|
|
lxc_hosts_remove_distro_packages:
|
|
|
|
- dnsmasq
|
|
|
|
|
2016-09-03 22:58:01 +00:00
|
|
|
lxc_xz_bin: pxz
|
|
|
|
|
2016-09-01 14:21:47 +00:00
|
|
|
system_config_dir: "/etc/default"
|
2017-04-24 13:57:18 +00:00
|
|
|
systemd_utils_prefix: "/lib/systemd"
|
2016-04-19 03:20:07 +00:00
|
|
|
lxc_cache_map:
|
|
|
|
distro: ubuntu
|
2016-05-06 23:39:09 +00:00
|
|
|
arch: "{{ lxc_architecture_mapping.get( ansible_architecture ) }}"
|
2016-04-19 03:20:07 +00:00
|
|
|
release: xenial
|
2016-05-11 14:43:45 +00:00
|
|
|
copy_from_host:
|
|
|
|
- /etc/apt/sources.list
|
|
|
|
- /etc/apt/apt.conf.d/
|
2017-08-29 12:46:26 +00:00
|
|
|
- /etc/apt/preferences.d/
|
2017-03-29 10:13:17 +00:00
|
|
|
- /etc/environment
|
2016-10-13 19:26:07 +00:00
|
|
|
- /etc/localtime
|
2016-05-19 10:50:38 +00:00
|
|
|
- /root/repo.keys
|
2016-05-11 14:43:45 +00:00
|
|
|
cache_prep_commands: |
|
2017-02-27 17:23:43 +00:00
|
|
|
{{ lxc_cache_prep_pre_commands }}
|
2017-03-31 10:49:28 +00:00
|
|
|
mkdir -p /etc/ansible/facts.d/
|
2016-08-17 16:13:28 +00:00
|
|
|
if [ -a /etc/resolv.conf ]; then
|
|
|
|
mv /etc/resolv.conf /etc/resolv.conf.org
|
|
|
|
fi
|
2017-03-01 04:55:34 +00:00
|
|
|
{% for resolver in lxc_cache_prep_dns %}
|
|
|
|
echo "nameserver {{ resolver }}" >> /etc/resolv.conf
|
|
|
|
{% endfor %}
|
2016-05-19 10:50:38 +00:00
|
|
|
apt-key add /root/repo.keys
|
|
|
|
rm /root/repo.keys
|
2016-06-21 14:48:12 +00:00
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2017-04-26 13:42:39 +00:00
|
|
|
apt-get remove -y --purge snap* lxc* lxd* || true
|
2017-06-09 16:03:25 +00:00
|
|
|
# Update base distribution
|
2016-06-21 14:48:12 +00:00
|
|
|
apt-get update
|
2017-06-09 16:03:25 +00:00
|
|
|
apt-get upgrade -y
|
2016-08-30 15:13:18 +00:00
|
|
|
apt-get install -y {{ lxc_cache_install_debconf }} {{ lxc_cache_distro_packages | join(' ') }}
|
2016-05-26 15:23:28 +00:00
|
|
|
apt-get upgrade -y {{ lxc_cache_install_debconf }}
|
2016-04-19 03:20:07 +00:00
|
|
|
rm -f /usr/bin/python
|
|
|
|
ln -s /usr/bin/python2.7 /usr/bin/python
|
|
|
|
mkdir -p /root/.ssh
|
|
|
|
chmod 700 /root/.ssh
|
|
|
|
userdel --force --remove ubuntu || true
|
|
|
|
apt-get clean
|
2016-07-26 15:09:21 +00:00
|
|
|
mkdir -p /var/backup
|
2016-08-11 14:08:26 +00:00
|
|
|
echo -e '{{ lxc_container_default_interfaces }}' | tee /etc/network/interfaces
|
|
|
|
mkdir -p /etc/network/interfaces.d
|
|
|
|
chage -I -1 -d -1 -m 0 -M 99999 -E -1 root
|
2016-08-17 16:13:28 +00:00
|
|
|
if [ -a /etc/resolv.conf.org ]; then
|
|
|
|
mv /etc/resolv.conf.org /etc/resolv.conf
|
|
|
|
else
|
|
|
|
rm -f /etc/resolv.conf
|
|
|
|
fi
|
2017-02-27 17:23:43 +00:00
|
|
|
{{ lxc_cache_prep_post_commands }}
|
2016-04-19 03:20:07 +00:00
|
|
|
|
2016-05-26 15:23:28 +00:00
|
|
|
# This forces any modified configurations to remain, and any unmodified configs to be replaced
|
|
|
|
# ref: http://serverfault.com/questions/259226/automatically-keep-current-version-of-config-files-when-apt-get-install
|
|
|
|
lxc_cache_install_debconf: '-o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --force-yes'
|
2016-04-19 03:20:07 +00:00
|
|
|
|
2017-09-12 17:21:46 +00:00
|
|
|
_lxc_cache_distro_packages:
|
2016-05-11 14:43:45 +00:00
|
|
|
- apt-transport-https
|
2016-05-19 17:05:24 +00:00
|
|
|
- ca-certificates
|
2017-09-26 09:26:56 +00:00
|
|
|
- cron # xenial doesn't have cronie
|
2016-05-11 14:43:45 +00:00
|
|
|
- openssh-server
|
|
|
|
- python2.7
|
2017-01-11 22:27:22 +00:00
|
|
|
- rsync
|
2017-09-26 09:26:56 +00:00
|
|
|
- sudo
|
|
|
|
- tar
|
|
|
|
- wget
|
|
|
|
- debianutils # for 'which' executable
|
2016-05-11 14:43:45 +00:00
|
|
|
|
2016-04-19 03:20:07 +00:00
|
|
|
lxc_cached_network_interfaces:
|
|
|
|
- src: "lxc-net-bridge.cfg.j2"
|
|
|
|
dest: "/etc/network/interfaces.d/lxc-net-bridge.cfg"
|
2016-08-11 14:08:26 +00:00
|
|
|
|
|
|
|
lxc_container_default_interfaces: |
|
|
|
|
# The loopback network interface
|
|
|
|
auto lo
|
|
|
|
iface lo inet loopback
|
|
|
|
# LXC interface, this is ALWAYS assumed to be DHCP.
|
|
|
|
auto eth0
|
|
|
|
iface eth0 inet dhcp
|
|
|
|
# Load any additional configs
|
|
|
|
source /etc/network/interfaces.d/*.cfg
|