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/default | |
| parent | 9314a3458a5b3add41cf31c41e8597165943840d (diff) | |
Refactor molecule testing to run a scenario per distro
Diffstat (limited to 'molecule/default')
| -rw-r--r-- | molecule/default/Dockerfile.archlinux.j2 | 24 | ||||
| -rw-r--r-- | molecule/default/Dockerfile.raspberrypi.j2 | 25 | ||||
| -rw-r--r-- | molecule/default/Dockerfile.ubuntu.j2 | 30 | ||||
| -rw-r--r-- | molecule/default/converge.yml | 52 | ||||
| -rw-r--r-- | molecule/default/molecule.yml | 41 |
5 files changed, 0 insertions, 172 deletions
diff --git a/molecule/default/Dockerfile.archlinux.j2 b/molecule/default/Dockerfile.archlinux.j2 deleted file mode 100644 index 1d5a1cd5..00000000 --- a/molecule/default/Dockerfile.archlinux.j2 +++ /dev/null @@ -1,24 +0,0 @@ -FROM docker.io/library/archlinux - -ENV container docker - -RUN pacman -Syu --noconfirm --needed python3 \ - && pacman -Scc --noconfirm - -RUN (cd /lib/systemd/system/sysinit.target.wants/; \ - for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ - rm -f /lib/systemd/system/multi-user.target.wants/*;\ - rm -f /etc/systemd/system/*.wants/*;\ - rm -f /lib/systemd/system/local-fs.target.wants/*; \ - rm -f /lib/systemd/system/sockets.target.wants/*udev*; \ - rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ - rm -f /lib/systemd/system/basic.target.wants/*;\ - rm -f /lib/systemd/system/anaconda.target.wants/*; - -# Workaround archlinux not including any non-indo-european locales -# https://gitlab.archlinux.org/archlinux/archlinux-docker/-/issues/59 -RUN cp -r /usr/share/i18n/locales/en_US /usr/share/i18n/locales/de_DE; - -VOLUME ["/sys/fs/cgroup"] - -CMD ["/lib/systemd/systemd"] diff --git a/molecule/default/Dockerfile.raspberrypi.j2 b/molecule/default/Dockerfile.raspberrypi.j2 deleted file mode 100644 index aa620c58..00000000 --- a/molecule/default/Dockerfile.raspberrypi.j2 +++ /dev/null @@ -1,25 +0,0 @@ -# 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/default/Dockerfile.ubuntu.j2 b/molecule/default/Dockerfile.ubuntu.j2 deleted file mode 100644 index 37199b55..00000000 --- a/molecule/default/Dockerfile.ubuntu.j2 +++ /dev/null @@ -1,30 +0,0 @@ -# Based on the amazing work of geerlingguy <3 -# FROM docker.io/geerlingguy/docker-ubuntu2404-ansible -FROM docker.io/library/ubuntu:noble - -ARG DEBIAN_FRONTEND=noninteractive - -ENV container docker - -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - locales systemd avahi-daemon python3 iproute2 ifupdown \ - && rm -Rf /var/lib/apt/lists/* \ - && rm -Rf /usr/share/doc \ - && rm -Rf /usr/share/man \ - && apt-get clean - -# Fix potential UTF-8 errors with ansible-test. -RUN locale-gen en_US.UTF-8 - -# Remove unnecessary getty and udev targets that result in high CPU usage when using -# multiple containers with Molecule (https://github.com/ansible/molecule/issues/1104) -RUN rm -f /lib/systemd/system/systemd*udev* \ - && rm -f /lib/systemd/system/getty.target - -# Mimic Ubuntu OS default boot (for testing) -RUN systemctl enable avahi-daemon - -VOLUME ["/sys/fs/cgroup", "/tmp", "/run", "/opt"] - -CMD ["/lib/systemd/systemd"] diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml deleted file mode 100644 index c435c56d..00000000 --- a/molecule/default/converge.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -- name: Converge - hosts: instance - gather_facts: true - vars: - ansible_become_method: su - network_wifi_ssid: "TEST_WIFI_SSID" - network_wifi_pass: "TEST_WIFI_PASS" - username: test_user - user_public_keys: - - "ssh-ed25519 AAAA...fMo" - - "ssh-rsa AAAA...4I3" - user_groups: ["wheel", "test_group"] - ssh_port: 1337 - locales: - - "en_US.UTF-8 UTF-8" - timezone: "GMT" - python_global_version: "3.13" - python_versions: - - "3.13" - pihole_interface: "eth0" - pihole_domain: "pi.hole" - wireguard_connections: - protonvpn-example: | - [Interface] - PrivateKey = your_private_key_here - Address = 10.2.0.2/32 - DNS = 10.2.0.1 - - [Peer] - PublicKey = server_public_key - AllowedIPs = 0.0.0.0/0 - Endpoint = example.protonvpn.com:51820 - roles: - - role: "network" - - role: "user" - - role: "ssh" - - role: "password_policy" - - role: "locales" - - role: "timezone" - - role: "homebrew" - - role: "python" - - role: "go" - - role: "docker" - - role: "podman" - - role: "ansible" - - role: "wireguard" - - role: "wireguard_gateway" - - role: "pihole" - when: - - lookup('ansible.builtin.env', 'MOLECULE_DISTRO') == 'ubuntu' or - lookup('ansible.builtin.env', 'MOLECULE_DISTRO') == 'raspberrypi' diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml deleted file mode 100644 index c0ec4e96..00000000 --- a/molecule/default/molecule.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -role_name_check: 1 -dependency: - name: galaxy - options: - ignore-errors: true -driver: - name: podman -platforms: - - name: instance - image: ${MOLECULE_DISTRO:-archlinux} - dockerfile: Dockerfile.${MOLECULE_DISTRO:-archlinux}.j2 - platform: "${MOLECULE_PLATFORM:-linux/amd64}" - 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: - MOLECULE_DISTRO: "${MOLECULE_DISTRO:-archlinux}" - 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 |
