From e1d160c01efb0597be15515f7811be69042ba5eb Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 15 Feb 2024 17:27:20 +0100 Subject: [PATCH 1/2] ansible: Document how to run a playbook against a local VM Add an example inventory for our standard cockpit bots `c` machine. It should be obvious from there how to extend it. --- ansible/README.md | 11 +++++++++++ ansible/inventory/localvm | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 ansible/inventory/localvm diff --git a/ansible/README.md b/ansible/README.md index b6bc4b21..927c0bb2 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -7,3 +7,14 @@ Setup/maintenance Ansible playbooks for Front Door CI * [e2e](./e2e/): Playbooks for configuring CI on e2e machines * [roles](./roles/): Ansible roles for common setup steps * [maintenance](./maintenance/): Ansible playbooks for maintenance tasks on all CI machines + +Testing against a local VM +--------------------------- + +You can run the Ansible playbooks or roles against a local VM for development. +There is an example [localvm inventory](./inventory/localvm) which adds the +[standard cockpit](https://github.com/cockpit-project/cockpit/blob/main/test/README.md#convenient-test-vm-ssh-access) +`c` SSH machine. Start e.g. a `fedora-coreos` or `fedora-39` VM, and locally +adjust the `hosts:` playbook you are working on from e.g. `e2e` to `localvm` +(the playbooks don't do that by default to avoid errors about unreachable +host). diff --git a/ansible/inventory/localvm b/ansible/inventory/localvm new file mode 100644 index 00000000..700bb2ed --- /dev/null +++ b/ansible/inventory/localvm @@ -0,0 +1,3 @@ +[localvm] +# standard cockpit test VM from bots +c From 66ce97347223fb1d5af6c7606d67b7a4d32c3a6f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 15 Feb 2024 18:12:02 +0100 Subject: [PATCH 2/2] ansible: Fix e2e/setup.yml for systems without zezere The playbook failed on machines without zezere, i.e. OSes other than Fedora IoT. It's too annoyingly complicated to do this declaratively, so just reach for the shell. --- ansible/e2e/setup.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ansible/e2e/setup.yml b/ansible/e2e/setup.yml index 4031639c..cdbc8d33 100644 --- a/ansible/e2e/setup.yml +++ b/ansible/e2e/setup.yml @@ -18,16 +18,11 @@ command: passwd -l root - name: Disable zezere service - service: - name: zezere_ignition.timer - state: stopped - enabled: no - - - name: Disable zezere banner - service: - name: zezere_ignition_banner.service - state: stopped - enabled: no + shell: | + if systemctl list-unit-files zezere_ignition.timer; then + systemctl disable --now zezere_ignition.timer + systemctl disable --now zezere_ignition_banner.service + fi - name: Disable unconnected network interfaces to avoid NM-wait-online timeout copy: