diff options
| author | Ahmed Abdelhalim <[email protected]> | 2025-09-04 00:25:57 +0200 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2025-09-04 00:25:57 +0200 |
| commit | 6725e4cc8f4e91b4215813171fa06d365721abed (patch) | |
| tree | 325a3a3629e11e95a4379e0dab9d6a91b08290ca /molecule/raspberrypi | |
| parent | 9314a3458a5b3add41cf31c41e8597165943840d (diff) | |
Refactor molecule testing to run a scenario per distro
Diffstat (limited to 'molecule/raspberrypi')
| -rw-r--r-- | molecule/raspberrypi/Dockerfile.j2 | 25 | ||||
| -rw-r--r-- | molecule/raspberrypi/converge.yml | 28 | ||||
| -rw-r--r-- | molecule/raspberrypi/molecule.yml | 40 |
3 files changed, 93 insertions, 0 deletions
diff --git a/molecule/raspberrypi/Dockerfile.j2 b/molecule/raspberrypi/Dockerfile.j2 new file mode 100644 index 00000000..aa620c58 --- /dev/null +++ b/molecule/raspberrypi/Dockerfile.j2 @@ -0,0 +1,25 @@ +# Based on the amazing work of geerlingguy <3 +# FROM docker.io/geerlingguy/docker-debian12-ansible +FROM docker.io/library/debian:bookworm + +ARG DEBIAN_FRONTEND=noninteractive + +ENV container docker + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + systemd python3 avahi-daemon iproute2 ifupdown \ + && rm -Rf /var/lib/apt/lists/* \ + && rm -Rf /usr/share/doc \ + && rm -Rf /usr/share/man \ + && apt-get clean + +RUN rm -f /lib/systemd/system/multi-user.target.wants/getty.target + +# Mimic Raspberry OS default boot (for testing) +RUN systemctl enable avahi-daemon \ + && touch /etc/locale.gen + +VOLUME ["/sys/fs/cgroup", "/tmp", "/run", "/opt"] + +CMD ["/lib/systemd/systemd"] diff --git a/molecule/raspberrypi/converge.yml b/molecule/raspberrypi/converge.yml new file mode 100644 index 00000000..0b6ef857 --- /dev/null +++ b/molecule/raspberrypi/converge.yml @@ -0,0 +1,28 @@ +--- +- name: Converge + hosts: raspberrypi + gather_facts: true + vars: + ansible_become_method: su + user_groups: ["wheel", "test_group"] + locales: + - "en_US.UTF-8 UTF-8" + timezone: "GMT" + pihole_interface: "eth0" + pihole_domain: "pi.hole" + pihole_totp_secret: "CHANGEME" + pihole_password: "{{ ('changeme' | hash('sha256') | hash('sha256'))[:64] }}" + pihole_dhcp_enabled: false + wireguard_gateway_enabled: true + wireguard_autostart_connection: "protonvpn-us-1" + roles: + - role: "hostname" + - role: "network" + - role: "user" + - role: "ssh" + - role: "password_policy" + - role: "locales" + - role: "timezone" + - role: "wireguard" + - role: "wireguard_gateway" + - role: "pihole" diff --git a/molecule/raspberrypi/molecule.yml b/molecule/raspberrypi/molecule.yml new file mode 100644 index 00000000..a1d57df3 --- /dev/null +++ b/molecule/raspberrypi/molecule.yml @@ -0,0 +1,40 @@ +--- +role_name_check: 1 +dependency: + name: galaxy + options: + ignore-errors: true +driver: + name: podman +platforms: + - name: raspberrypi + dockerfile: Dockerfile.j2 + platform: "linux/arm64/v8" + pre_build_image: false + privileged: true + command: ${MOLECULE_COMMAND:-"/lib/systemd/systemd"} + tmpfs: + "/tmp": "rw" + "/run": "rw,exec" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + cgroupns_mode: host + +provisioner: + name: ansible + inventory: + links: + host_vars: "../../host_vars/" + group_vars: "../../group_vars/" + env: + ANSIBLE_ROLES_PATH: "../../roles" + config_options: + defaults: + callback_result_format: yaml + interpreter_python: /usr/bin/python3 + ssh_connection: + pipelining: true + playbooks: + converge: converge.yml +verifier: + name: ansible |
