openstack-ansible-lxc_hosts/vars/ubuntu-16.04.yml
Charles Farquhar a2bcc99dfa
Clear apt lists in LXC image before apt-get update
When using an Ubuntu mirror that is different from the mirror used
to build the LXC image, differences in the mirror metadata can result
in a "Hash Sum mismatch" error during apt-get update.

Ading "rm -rf /var/lib/apt/lists/*" to lxc_cache_commands prevents
the problem.

Change-Id: I5fde7d0e7e84a6bd4f72dbf16d0fdfe423a2d715
Closes-Bug: 1574936
2016-05-03 08:51:14 -05:00

86 lines
2.9 KiB
YAML

---
# 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
# Container repos
lxc_container_template_main_apt_repo: "https://mirror.rackspace.com/ubuntu"
lxc_container_template_security_apt_repo: "{{ lxc_container_template_main_apt_repo }}"
lxc_container_template_apt_components:
- main
- universe
# Required apt packages.
lxc_packages:
- apparmor
- apparmor-utils
- bridge-utils
- cgmanager
- cgroup-lite
- debootstrap
- dnsmasq
- git
- irqbalance
- language-pack-en
- liblxc1
- lxc
- lxc-dev
- lxc-templates
- python-dev
- python3-lxc
- pxz
lxc_cache_map:
distro: ubuntu
arch: amd64
release: xenial
cache_packages:
- openssh-server
repos:
"/etc/apt/sources.list": |
deb {{ lxc_container_template_main_apt_repo }} xenial {{ lxc_container_template_apt_components | join(' ') }}
deb {{ lxc_container_template_main_apt_repo }} xenial-updates {{ lxc_container_template_apt_components | join(' ') }}
deb {{ lxc_container_template_main_apt_repo }} xenial-backports {{ lxc_container_template_apt_components | join(' ') }}
deb {{ lxc_container_template_security_apt_repo }} xenial-security {{ lxc_container_template_apt_components | join(' ') }}
cache_base_commands: |
rm /run/resolvconf/resolv.conf
# This enforces the resolvers from within the image
{% for resolver in lxc_cache_resolvers %}
echo "{{ resolver }}" | tee -a /run/resolvconf/resolv.conf
{% endfor %}
cp /run/resolvconf/resolv.conf /etc/resolvconf/resolv.conf.d/base
echo "# NONE" > /etc/resolvconf/resolv.conf.d/tail
echo "# NONE" > /etc/resolvconf/resolv.conf.d/original
rm -rf /var/lib/apt/lists/*
# This is done because its possible the base repos being installed will use https
# and ansible needs access to python2.7 which the system may not have by default
{{ lxc_cache_install_command }} apt-transport-https python2.7
apt-get -y upgrade
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
cache_post_commands: |
apt-get clean
lxc_cache_install_command: "export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -y"
lxc_cached_network_interfaces:
- src: "lxc-net-bridge.cfg.j2"
dest: "/etc/network/interfaces.d/lxc-net-bridge.cfg"