openstack-ansible-lxc_hosts/vars/ubuntu-16.04.yml

127 lines
3.5 KiB
YAML
Raw Normal View History

---
# 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.
lxc_hosts_distro_packages:
- apparmor
- apparmor-utils
- aria2
- bridge-utils
- btrfs-tools
- cgmanager
- cgroup-lite
- dbus
- debootstrap
- dnsmasq-base
- git
- iptables
- irqbalance
- language-pack-en
- liblxc1
- lxc
- lxc-dev
- lxc-templates
- python-dev
- python3-lxc
- systemd-container
- pxz
# Package to remove from the host
lxc_hosts_remove_distro_packages:
- dnsmasq
lxc_xz_bin: pxz
system_config_dir: "/etc/default"
systemd_utils_prefix: "/lib/systemd"
lxc_cache_map:
distro: ubuntu
arch: "{{ lxc_architecture_mapping.get( ansible_architecture ) }}"
release: xenial
Make the LXC cache prep use the host package source config Currently the container cache preparation process uses a pre-prepared LXC base image which includes its own package repository configuration. This presents a few problems: - The first packages installed will make use of the base image's package repo configuration, resulting in a bypass of local mirrors to install the first set of packages. - A set of vars need to be set in order to have the containers use a local mirror, otherwise it'll use the mirrors set in the role's vars files. This is counterintuitive. Another problem introduced by I95c210c83ca968d11ba6f6a36b634bb798fa291f as a result of the package repository vars moving from the role defaults to the vars files is that the precedence has changed. The change in precedence means that a task which sets a fact can't be used to override the defaults set in the vars file. This method is used in all the role tests to ensure that the OpenStack-CI repositories can be discovered from the host and then used. This patch changes the image cache preparation process to ensure that the container package repository configuration matches the host configuration. This is simpler and more intuitive. Additionally the copy task from the deployment host into the container cache is set to assume the same destination in the container as the source (to reduce configuration verbosity), appropriately sets the leading '0' for the mode (to prevent unexpected surprises), and appropriately quotes the variable (to ensure forward compatibility with Ansible 2.0). Finally, the use of lxc_container_caches in the test configuration has been removed as it is no longer used. Change-Id: I420382fd3bbbb5fcae90ae0c6160233202a1a51a
2016-05-11 14:43:45 +00:00
copy_from_host:
- /etc/apt/sources.list
- /etc/apt/apt.conf.d/
- /etc/apt/preferences.d/
- /etc/environment
- /etc/localtime
- /root/repo.keys
Make the LXC cache prep use the host package source config Currently the container cache preparation process uses a pre-prepared LXC base image which includes its own package repository configuration. This presents a few problems: - The first packages installed will make use of the base image's package repo configuration, resulting in a bypass of local mirrors to install the first set of packages. - A set of vars need to be set in order to have the containers use a local mirror, otherwise it'll use the mirrors set in the role's vars files. This is counterintuitive. Another problem introduced by I95c210c83ca968d11ba6f6a36b634bb798fa291f as a result of the package repository vars moving from the role defaults to the vars files is that the precedence has changed. The change in precedence means that a task which sets a fact can't be used to override the defaults set in the vars file. This method is used in all the role tests to ensure that the OpenStack-CI repositories can be discovered from the host and then used. This patch changes the image cache preparation process to ensure that the container package repository configuration matches the host configuration. This is simpler and more intuitive. Additionally the copy task from the deployment host into the container cache is set to assume the same destination in the container as the source (to reduce configuration verbosity), appropriately sets the leading '0' for the mode (to prevent unexpected surprises), and appropriately quotes the variable (to ensure forward compatibility with Ansible 2.0). Finally, the use of lxc_container_caches in the test configuration has been removed as it is no longer used. Change-Id: I420382fd3bbbb5fcae90ae0c6160233202a1a51a
2016-05-11 14:43:45 +00:00
cache_prep_commands: |
{{ lxc_cache_prep_pre_commands }}
mkdir -p /etc/ansible/facts.d/
if [ -a /etc/resolv.conf ]; then
mv /etc/resolv.conf /etc/resolv.conf.org
fi
{% for resolver in lxc_cache_prep_dns %}
echo "nameserver {{ resolver }}" >> /etc/resolv.conf
{% endfor %}
apt-key add /root/repo.keys
rm /root/repo.keys
export DEBIAN_FRONTEND=noninteractive
apt-get remove -y --purge snap* lxc* lxd* || true
# Update base distribution
apt-get update
apt-get upgrade -y
apt-get install -y {{ lxc_cache_install_debconf }} {{ lxc_cache_distro_packages | join(' ') }}
apt-get upgrade -y {{ lxc_cache_install_debconf }}
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
mkdir -p /var/backup
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
if [ -a /etc/resolv.conf.org ]; then
mv /etc/resolv.conf.org /etc/resolv.conf
else
rm -f /etc/resolv.conf
fi
{{ lxc_cache_prep_post_commands }}
# 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'
_lxc_cache_distro_packages:
Make the LXC cache prep use the host package source config Currently the container cache preparation process uses a pre-prepared LXC base image which includes its own package repository configuration. This presents a few problems: - The first packages installed will make use of the base image's package repo configuration, resulting in a bypass of local mirrors to install the first set of packages. - A set of vars need to be set in order to have the containers use a local mirror, otherwise it'll use the mirrors set in the role's vars files. This is counterintuitive. Another problem introduced by I95c210c83ca968d11ba6f6a36b634bb798fa291f as a result of the package repository vars moving from the role defaults to the vars files is that the precedence has changed. The change in precedence means that a task which sets a fact can't be used to override the defaults set in the vars file. This method is used in all the role tests to ensure that the OpenStack-CI repositories can be discovered from the host and then used. This patch changes the image cache preparation process to ensure that the container package repository configuration matches the host configuration. This is simpler and more intuitive. Additionally the copy task from the deployment host into the container cache is set to assume the same destination in the container as the source (to reduce configuration verbosity), appropriately sets the leading '0' for the mode (to prevent unexpected surprises), and appropriately quotes the variable (to ensure forward compatibility with Ansible 2.0). Finally, the use of lxc_container_caches in the test configuration has been removed as it is no longer used. Change-Id: I420382fd3bbbb5fcae90ae0c6160233202a1a51a
2016-05-11 14:43:45 +00:00
- apt-transport-https
- ca-certificates
- cron # xenial doesn't have cronie
Make the LXC cache prep use the host package source config Currently the container cache preparation process uses a pre-prepared LXC base image which includes its own package repository configuration. This presents a few problems: - The first packages installed will make use of the base image's package repo configuration, resulting in a bypass of local mirrors to install the first set of packages. - A set of vars need to be set in order to have the containers use a local mirror, otherwise it'll use the mirrors set in the role's vars files. This is counterintuitive. Another problem introduced by I95c210c83ca968d11ba6f6a36b634bb798fa291f as a result of the package repository vars moving from the role defaults to the vars files is that the precedence has changed. The change in precedence means that a task which sets a fact can't be used to override the defaults set in the vars file. This method is used in all the role tests to ensure that the OpenStack-CI repositories can be discovered from the host and then used. This patch changes the image cache preparation process to ensure that the container package repository configuration matches the host configuration. This is simpler and more intuitive. Additionally the copy task from the deployment host into the container cache is set to assume the same destination in the container as the source (to reduce configuration verbosity), appropriately sets the leading '0' for the mode (to prevent unexpected surprises), and appropriately quotes the variable (to ensure forward compatibility with Ansible 2.0). Finally, the use of lxc_container_caches in the test configuration has been removed as it is no longer used. Change-Id: I420382fd3bbbb5fcae90ae0c6160233202a1a51a
2016-05-11 14:43:45 +00:00
- openssh-server
- python2.7
- rsync
- sudo
- tar
- wget
- debianutils # for 'which' executable
Make the LXC cache prep use the host package source config Currently the container cache preparation process uses a pre-prepared LXC base image which includes its own package repository configuration. This presents a few problems: - The first packages installed will make use of the base image's package repo configuration, resulting in a bypass of local mirrors to install the first set of packages. - A set of vars need to be set in order to have the containers use a local mirror, otherwise it'll use the mirrors set in the role's vars files. This is counterintuitive. Another problem introduced by I95c210c83ca968d11ba6f6a36b634bb798fa291f as a result of the package repository vars moving from the role defaults to the vars files is that the precedence has changed. The change in precedence means that a task which sets a fact can't be used to override the defaults set in the vars file. This method is used in all the role tests to ensure that the OpenStack-CI repositories can be discovered from the host and then used. This patch changes the image cache preparation process to ensure that the container package repository configuration matches the host configuration. This is simpler and more intuitive. Additionally the copy task from the deployment host into the container cache is set to assume the same destination in the container as the source (to reduce configuration verbosity), appropriately sets the leading '0' for the mode (to prevent unexpected surprises), and appropriately quotes the variable (to ensure forward compatibility with Ansible 2.0). Finally, the use of lxc_container_caches in the test configuration has been removed as it is no longer used. Change-Id: I420382fd3bbbb5fcae90ae0c6160233202a1a51a
2016-05-11 14:43:45 +00:00
lxc_cached_network_interfaces:
- src: "lxc-net-bridge.cfg.j2"
dest: "/etc/network/interfaces.d/lxc-net-bridge.cfg"
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