a5e5567369
Without this patch, any errors that happen during the 'apt-get update' execution will cause the 'apt-get install' execution to never happen. This patch implements the following: - It sets the cache prep script to exit on error to ensure that the task fails if there is an error. - It splits the upgrade and install command on to different lines to ensure that each command's success can be determined individually. - It removes the clearing of the archive metadata introduced in https://review.openstack.org/310091 as this also removes apt lock files and other things which should not be removed. Removing all this is unnecessary with the new cache prep process and the 'apt-get clean' execution later clears the cache before it is packaged. - It removes the copy of /etc/apt/sources.list.d/ from the host to prevent a situation where a host apt source requires additional packages to be installed (for example curl) and those packages can't be installed due to the 'apt-get update' command failing because the package to update the index is missing. Change-Id: I07a864e4125a7fc076cbf5bf7380a8e34e6d2d7c
82 lines
2.2 KiB
YAML
82 lines
2.2 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
|
|
|
|
# Required apt packages.
|
|
lxc_packages:
|
|
- apparmor
|
|
- apparmor-utils
|
|
- bridge-utils
|
|
- cgmanager
|
|
- cgroup-lite
|
|
- debootstrap
|
|
- dnsmasq
|
|
- git
|
|
- iptables
|
|
- irqbalance
|
|
- language-pack-en
|
|
- liblxc1
|
|
- lxc
|
|
- lxc-dev
|
|
- lxc-templates
|
|
- python-dev
|
|
- python3-lxc
|
|
- pxz
|
|
|
|
lxc_cache_map:
|
|
distro: ubuntu
|
|
arch: "{{ lxc_architecture_mapping.get( ansible_architecture ) }}"
|
|
release: xenial
|
|
cache_packages:
|
|
- apt-transport-https
|
|
- openssh-server
|
|
copy_from_host:
|
|
- /etc/apt/sources.list
|
|
- /etc/apt/apt.conf.d/
|
|
- /run/resolvconf/
|
|
- /etc/resolvconf/
|
|
- /etc/resolv.conf
|
|
- /root/repo.keys
|
|
cache_prep_commands: |
|
|
apt-key add /root/repo.keys
|
|
rm /root/repo.keys
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update
|
|
apt-get install -y {{ lxc_cache_install_debconf }} {{ lxc_cache_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
|
|
|
|
# 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_packages:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- iptables
|
|
- openssh-server
|
|
- python2.7
|
|
|
|
lxc_cached_network_interfaces:
|
|
- src: "lxc-net-bridge.cfg.j2"
|
|
dest: "/etc/network/interfaces.d/lxc-net-bridge.cfg"
|