Skip to content
34 changes: 27 additions & 7 deletions playbooks/roles/guestfs/tasks/destroy.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
---
- name: Destroy each target node
- name: Gather the list of running libvirt guests
run_once: true
community.libvirt.virt:
name: "{{ inventory_hostname }}"
command: "destroy"
command: list_vms
state: running
uri: "{{ libvirt_uri }}"
failed_when: false # Do not fail if the target node is not currently running
register: running_vms

- name: Undefine each target node
- name: Shut down each running target node
community.libvirt.virt:
name: "{{ inventory_hostname }}"
command: "undefine"
command: destroy
uri: "{{ libvirt_uri }}"
changed_when: true
when:
- inventory_hostname in running_vms.list_vms

- name: Gather the list of stopped libvirt guests
run_once: true
community.libvirt.virt:
command: list_vms
state: shutdown
uri: "{{ libvirt_uri }}"
register: shutdown_vms

- name: Undefine each stopped target node
community.libvirt.virt:
command: "undefine"
force: true
failed_when: false # Do not fail if the target node is not currently defined
name: "{{ inventory_hostname }}"
uri: "{{ libvirt_uri }}"
changed_when: true
when:
- inventory_hostname in shutdown_vms.list_vms

- name: Remove per-node configuration files
ansible.builtin.file:
Expand Down
3 changes: 0 additions & 3 deletions playbooks/roles/guestfs/tasks/install-deps/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
---
- name: Gathering facts
ansible.builtin.gather_facts:

- name: Debian-specific setup
ansible.builtin.import_tasks:
file: debian/main.yml
Expand Down
28 changes: 11 additions & 17 deletions playbooks/roles/guestfs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,37 @@
tags:
- install-deps
ansible.builtin.import_tasks:
file: "{{role_path }}/tasks/install-deps/main.yml"
file: "{{ role_path }}/tasks/install-deps/main.yml"

- name: Ensure a storage pool for guestfs exists
delegate_to: localhost
run_once: true
tags:
- bringup
- pool
ansible.builtin.import_tasks:
file: "{{role_path }}/tasks/bringup/storage-pool-path.yml"
file: "{{ role_path }}/tasks/bringup/storage-pool-path.yml"

- name: Ensure libvirt networking has started
delegate_to: localhost
run_once: true
tags:
- bringup
- network
ansible.builtin.import_tasks:
file: "{{role_path }}/tasks/bringup/network.yml"
file: "{{ role_path }}/tasks/bringup/network.yml"

- name: Set the pathname of storage pool directory
tags:
- base_image
- bringup
ansible.builtin.set_fact:
storagedir: "{{ kdevops_storage_pool_path }}/guestfs"

- name: Set the pathname of the OS base image
tags:
- base_image
- bringup
ansible.builtin.set_fact:
base_image: "{{ storagedir }}/base_images/{{ virtbuilder_os_version }}.raw"

- name: Ensure the base OS image exists
delegate_to: localhost
run_once: true
- name: Ensure the required base OS image exists
tags:
- bringup
- base_image
ansible.builtin.import_role:
name: base_image
vars:
Expand All @@ -48,13 +44,11 @@
tags:
- bringup
ansible.builtin.import_tasks:
file: "{{role_path }}/tasks/bringup/main.yml"
file: "{{ role_path }}/tasks/bringup/main.yml"

- name: Set up target node console permissions
delegate_to: localhost
run_once: true
tags:
- bringup
- console
ansible.builtin.import_tasks:
file: "{{ role_path }}/tasks/bringup/console-permissions.yml"
when:
Expand Down
3 changes: 2 additions & 1 deletion playbooks/terraform.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
- hosts: all
- name: Provision target nodes with terraform
gather_facts: false
hosts: all
roles:
- role: terraform
10 changes: 10 additions & 0 deletions scripts/guestfs.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,20 @@ install_libguestfs:
--tags install-deps

bringup_guestfs: $(GUESTFS_BRINGUP_DEPS)
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--connection=local --inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/guestfs.yml \
--extra-vars=@./extra_vars.yaml \
--tags network,pool,base_image
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
-i hosts playbooks/guestfs.yml \
--extra-vars=@./extra_vars.yaml \
--tags bringup
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
--connection=local --inventory localhost, \
$(KDEVOPS_PLAYBOOKS_DIR)/guestfs.yml \
--extra-vars=@./extra_vars.yaml \
--tags console
PHONY += bringup_guestfs

status_guestfs:
Expand Down
8 changes: 8 additions & 0 deletions terraform/aws/kconfigs/distros/Kconfig.fedora
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ config TERRAFORM_AWS_FEDORA40_X86_64
config TERRAFORM_AWS_FEDORA41_X86_64
bool "Fedora 41 (x86_64)"

config TERRAFORM_AWS_FEDORA42_X86_64
bool "Fedora 42 (x86_64)"

endchoice

config TERRAFORM_AWS_NS
string
output yaml
default "Fedora-Cloud-Base-AmazonEC2.x86_64-40-*" if TERRAFORM_AWS_FEDORA40_X86_64
default "Fedora-Cloud-Base-AmazonEC2.x86_64-41-*" if TERRAFORM_AWS_FEDORA41_X86_64
default "Fedora-Cloud-Base-AmazonEC2.x86_64-42-*" if TERRAFORM_AWS_FEDORA42_X86_64

endif # TARGET_ARCH_X86_64

Expand All @@ -39,13 +43,17 @@ config TERRAFORM_AWS_FEDORA40_ARM64
config TERRAFORM_AWS_FEDORA41_ARM64
bool "Fedora 41 (arm64"

config TERRAFORM_AWS_FEDORA42_ARM64
bool "Fedora 42 (arm64"

endchoice

config TERRAFORM_AWS_NS
string
output yaml
default "Fedora-Cloud-Base-AmazonEC2.aarch64-40-*" if TERRAFORM_AWS_FEDORA40_ARM64
default "Fedora-Cloud-Base-AmazonEC2.aarch64-41-*" if TERRAFORM_AWS_FEDORA41_ARM64
default "Fedora-Cloud-Base-AmazonEC2.aarch64-42-*" if TERRAFORM_AWS_FEDORA42_ARM64

endif # TARGET_ARCH_ARM64

Expand Down
8 changes: 8 additions & 0 deletions terraform/azure/kconfigs/publishers/Kconfig.rhel
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ config TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_5
This option sets the OS image to Red Hat Enterprise Linux
release 9 update 5.

config TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_6
bool "RHEL 9.6 x64"
help
This option sets the OS image to Red Hat Enterprise Linux
release 9 update 6.

endchoice

config TERRAFORM_AZURE_IMAGE_OFFER
Expand All @@ -35,13 +41,15 @@ config TERRAFORM_AZURE_IMAGE_OFFER
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_7_9
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_8_9
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_5
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_6

config TERRAFORM_AZURE_IMAGE_SKU
string
output yaml
default "7_9" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_7_9
default "8_9" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_8_9
default "9_5" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_5
default "9_6" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_6

endif # TARGET_ARCH_X86_64

Expand Down