Add package install assertions to SUSE base image

The SUSE base image is using ONLY the leap repositories by default. This
change provides access to the the tumbleweed repos at a far lower
priority giving deployers access to newer packages and features should
they need them without breaking typical LEAP support. One such package
being installed today is "systemd" which gives our container systems
access to systemd 234 which resolves numerous bugs and provides for
some of the mode advanced systemd built-ins we're looking to consume
elsewhere.

In developing this change It was discovered that the flag "--no-confirm"
was not being passed in, which can, in some circumstances cause the
zypper package manager to hang asking for user input. While this flag
is generally assumed given our other options passing it in to the
installation tasks will ensure we're never waiting for user input on
an automated base image build.

Change-Id: Ie214cbd77280321b1795e11020a72dc73cb70c62
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-11-28 02:31:46 -06:00 committed by Kevin Carter (cloudnull)
parent 6c95371210
commit 163341e624

View File

@ -59,14 +59,17 @@ lxc_cache_map:
# We have (tried to!) copied repo-oss and repo-update from the host so wipe everything else.
find /etc/zypp/repos.d/ -type f ! -name "repo-oss.repo" -a ! -name "repo-update.repo" -delete
zypper lr | grep -q 'repo-oss' || zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/distribution/leap/{{ ansible_distribution_version }}/repo/oss repo-oss
zypper lr | grep -q 'repo-update' || zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/update/leap/{{ ansible_distribution_version }}/oss/ repo-update
zypper lr | grep -q 'repo-update' || zypper --quiet ar {{ lxc_hosts_opensuse_mirror_url }}/update/leap/{{ ansible_distribution_version }}/oss repo-update
zypper lr | grep -q 'tumbleweed-oss' || zypper --quiet ar --priority 999 {{ lxc_hosts_opensuse_mirror_url }}/tumbleweed/repo/oss tumbleweed-oss
zypper locks | grep -q 'systemd' || zypper --quiet al --repo tumbleweed-oss systemd
# Disable recommended packages. Only update what's really needed
if ! fgrep -qx "solver.onlyRequires = true" /etc/zypp/zypp.conf; then
echo -e "\n\n## Disable recommended packages\nsolver.onlyRequires = true" >> /etc/zypp/zypp.conf
fi
# Update base distribution
zypper --gpg-auto-import-keys -n dup --force-resolution -l
zypper --gpg-auto-import-keys -n in --force-resolution -l {{ lxc_cache_distro_packages | join(' ') }}
zypper --gpg-auto-import-keys -n dup --force-resolution -l --no-confirm
zypper --gpg-auto-import-keys -n in --force-resolution -l --no-confirm {{ lxc_cache_distro_packages | join(' ') }}
zypper --gpg-auto-import-keys -n in --force-resolution -l --no-confirm --repo tumbleweed-oss systemd
mkdir -p /var/backup
echo -e '{{ lxc_container_default_interfaces }}' | tee /etc/sysconfig/network/ifcfg-eth0
chage -I -1 -d -1 -m 0 -M 99999 -E -1 root
@ -84,6 +87,7 @@ lxc_cache_map:
_lxc_cache_distro_packages:
- ca-certificates-mozilla
- cronie
- less
- openssh
- python
- python-xml