ci: Factor out image prep bootstrap as a role

Promoting the script to a full template will fix some whitespace errors later.
pull/1254/head
Alex Willmer 10 months ago
parent d1c4217db0
commit 780f8af1a4

@ -2,18 +2,8 @@
hosts: all
strategy: linear
gather_facts: false
tasks:
- name: Install bootstrap packages
raw: |
set -o errexit
set -o nounset
if type -p yum; then
yum -y install {{ bootstrap_packages | join(' ') }}
else
apt-get -y update
apt-get -y --no-install-recommends install {{ bootstrap_packages | join(' ') }}
fi
when: bootstrap_packages | length
roles:
- role: bootstrap
- name: Setup containers
hosts: all

@ -0,0 +1,3 @@
- name: Bootstrap
raw: "{{ lookup('template', 'bootstrap.sh.j2') }}"
changed_when: true

@ -0,0 +1,13 @@
set -o errexit
set -o nounset
{% if bootstrap_packages %}
if command -v apt-get; then
apt-get -y update
apt-get -y --no-install-recommends install {{ bootstrap_packages | join(' ') }}
elif command -v yum; then
yum -y install {{ bootstrap_packages | join(' ') }}
else
exit 42
fi
{% endif %}
Loading…
Cancel
Save