Upgrade installed packages with the bootstrap dependencies to avoid OpenSSL file conflicts on the Arch base image. Co-authored-by: Copilot <copilot@github.com>
62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
---
|
|
|
|
- name: Prepare
|
|
hosts: all
|
|
gather_facts: false
|
|
vars:
|
|
# The base images ship neither a python interpreter for ansible nor the package manager bindings the role relies on.
|
|
_bootstrap: |
|
|
set -eu
|
|
if command -v pacman > /dev/null; then
|
|
pacman --sync --refresh --sysupgrade --noconfirm python shadow
|
|
elif command -v apt-get > /dev/null; then
|
|
apt-get update
|
|
apt-get install --yes passwd python3 python3-apt
|
|
else
|
|
dnf install --assumeyes python3 python3-libdnf5 shadow-utils
|
|
fi
|
|
tasks:
|
|
# The raw command is wrapped explicitly, because the bootstrap relies on shell builtins.
|
|
- name: Bootstrap the python interpreter and the package manager bindings
|
|
ansible.builtin.raw: "/bin/sh -c {{ _bootstrap | quote }}"
|
|
changed_when: true
|
|
|
|
- name: Seed the objects the converge refers to
|
|
hosts: all
|
|
tasks:
|
|
- name: Create the groups the converge grants permissions to
|
|
ansible.builtin.group:
|
|
name: "{{ item }}"
|
|
state: present
|
|
loop:
|
|
- molecule-admins
|
|
- molecule-ops
|
|
|
|
- name: Create the users the converge grants permissions to
|
|
ansible.builtin.user:
|
|
name: "{{ item }}"
|
|
group: users
|
|
state: present
|
|
loop:
|
|
- molecule-alice
|
|
- molecule-bob
|
|
|
|
- name: Create the drop-in directory for the seeded files
|
|
ansible.builtin.file:
|
|
path: /etc/sudoers.d
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0750"
|
|
|
|
- name: Seed the obsolete and unmanaged drop-in files
|
|
ansible.builtin.copy:
|
|
content: "molecule-alice ALL=NOPASSWD: /usr/bin/true\n"
|
|
dest: '/etc/sudoers.d/{{ item }}'
|
|
owner: root
|
|
group: root
|
|
mode: "0440"
|
|
loop:
|
|
- molecule-obsolete
|
|
- molecule-unmanaged
|