Skip to content

Commit bf6c08c

Browse files
authored
Merge pull request #4 from linux-kdevops/cel/20250625
Fixes and clean-ups for provisioning methods
2 parents 9a94c48 + 10a2a27 commit bf6c08c

File tree

7 files changed

+66
-28
lines changed

7 files changed

+66
-28
lines changed

playbooks/roles/guestfs/tasks/destroy.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
---
2-
- name: Destroy each target node
2+
- name: Gather the list of running libvirt guests
3+
run_once: true
34
community.libvirt.virt:
4-
name: "{{ inventory_hostname }}"
5-
command: "destroy"
5+
command: list_vms
6+
state: running
67
uri: "{{ libvirt_uri }}"
7-
failed_when: false # Do not fail if the target node is not currently running
8+
register: running_vms
89

9-
- name: Undefine each target node
10+
- name: Shut down each running target node
1011
community.libvirt.virt:
1112
name: "{{ inventory_hostname }}"
12-
command: "undefine"
13+
command: destroy
14+
uri: "{{ libvirt_uri }}"
15+
changed_when: true
16+
when:
17+
- inventory_hostname in running_vms.list_vms
18+
19+
- name: Gather the list of stopped libvirt guests
20+
run_once: true
21+
community.libvirt.virt:
22+
command: list_vms
23+
state: shutdown
1324
uri: "{{ libvirt_uri }}"
25+
register: shutdown_vms
26+
27+
- name: Undefine each stopped target node
28+
community.libvirt.virt:
29+
command: "undefine"
1430
force: true
15-
failed_when: false # Do not fail if the target node is not currently defined
31+
name: "{{ inventory_hostname }}"
32+
uri: "{{ libvirt_uri }}"
33+
changed_when: true
34+
when:
35+
- inventory_hostname in shutdown_vms.list_vms
1636

1737
- name: Remove per-node configuration files
1838
ansible.builtin.file:

playbooks/roles/guestfs/tasks/install-deps/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
---
2-
- name: Gathering facts
3-
ansible.builtin.gather_facts:
4-
52
- name: Debian-specific setup
63
ansible.builtin.import_tasks:
74
file: debian/main.yml

playbooks/roles/guestfs/tasks/main.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,37 @@
33
tags:
44
- install-deps
55
ansible.builtin.import_tasks:
6-
file: "{{role_path }}/tasks/install-deps/main.yml"
6+
file: "{{ role_path }}/tasks/install-deps/main.yml"
77

88
- name: Ensure a storage pool for guestfs exists
9-
delegate_to: localhost
10-
run_once: true
119
tags:
12-
- bringup
10+
- pool
1311
ansible.builtin.import_tasks:
14-
file: "{{role_path }}/tasks/bringup/storage-pool-path.yml"
12+
file: "{{ role_path }}/tasks/bringup/storage-pool-path.yml"
1513

1614
- name: Ensure libvirt networking has started
17-
delegate_to: localhost
18-
run_once: true
1915
tags:
20-
- bringup
16+
- network
2117
ansible.builtin.import_tasks:
22-
file: "{{role_path }}/tasks/bringup/network.yml"
18+
file: "{{ role_path }}/tasks/bringup/network.yml"
2319

2420
- name: Set the pathname of storage pool directory
2521
tags:
22+
- base_image
2623
- bringup
2724
ansible.builtin.set_fact:
2825
storagedir: "{{ kdevops_storage_pool_path }}/guestfs"
2926

3027
- name: Set the pathname of the OS base image
3128
tags:
29+
- base_image
3230
- bringup
3331
ansible.builtin.set_fact:
3432
base_image: "{{ storagedir }}/base_images/{{ virtbuilder_os_version }}.raw"
3533

36-
- name: Ensure the base OS image exists
37-
delegate_to: localhost
38-
run_once: true
34+
- name: Ensure the required base OS image exists
3935
tags:
40-
- bringup
36+
- base_image
4137
ansible.builtin.import_role:
4238
name: base_image
4339
vars:
@@ -48,13 +44,11 @@
4844
tags:
4945
- bringup
5046
ansible.builtin.import_tasks:
51-
file: "{{role_path }}/tasks/bringup/main.yml"
47+
file: "{{ role_path }}/tasks/bringup/main.yml"
5248

5349
- name: Set up target node console permissions
54-
delegate_to: localhost
55-
run_once: true
5650
tags:
57-
- bringup
51+
- console
5852
ansible.builtin.import_tasks:
5953
file: "{{ role_path }}/tasks/bringup/console-permissions.yml"
6054
when:

playbooks/terraform.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
- hosts: all
2+
- name: Provision target nodes with terraform
33
gather_facts: false
4+
hosts: all
45
roles:
56
- role: terraform

scripts/guestfs.Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,20 @@ install_libguestfs:
7575
--tags install-deps
7676

7777
bringup_guestfs: $(GUESTFS_BRINGUP_DEPS)
78+
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
79+
--connection=local --inventory localhost, \
80+
$(KDEVOPS_PLAYBOOKS_DIR)/guestfs.yml \
81+
--extra-vars=@./extra_vars.yaml \
82+
--tags network,pool,base_image
7883
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
7984
-i hosts playbooks/guestfs.yml \
8085
--extra-vars=@./extra_vars.yaml \
8186
--tags bringup
87+
$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
88+
--connection=local --inventory localhost, \
89+
$(KDEVOPS_PLAYBOOKS_DIR)/guestfs.yml \
90+
--extra-vars=@./extra_vars.yaml \
91+
--tags console
8292
PHONY += bringup_guestfs
8393

8494
status_guestfs:

terraform/aws/kconfigs/distros/Kconfig.fedora

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ config TERRAFORM_AWS_FEDORA40_X86_64
1717
config TERRAFORM_AWS_FEDORA41_X86_64
1818
bool "Fedora 41 (x86_64)"
1919

20+
config TERRAFORM_AWS_FEDORA42_X86_64
21+
bool "Fedora 42 (x86_64)"
22+
2023
endchoice
2124

2225
config TERRAFORM_AWS_NS
2326
string
2427
output yaml
2528
default "Fedora-Cloud-Base-AmazonEC2.x86_64-40-*" if TERRAFORM_AWS_FEDORA40_X86_64
2629
default "Fedora-Cloud-Base-AmazonEC2.x86_64-41-*" if TERRAFORM_AWS_FEDORA41_X86_64
30+
default "Fedora-Cloud-Base-AmazonEC2.x86_64-42-*" if TERRAFORM_AWS_FEDORA42_X86_64
2731

2832
endif # TARGET_ARCH_X86_64
2933

@@ -39,13 +43,17 @@ config TERRAFORM_AWS_FEDORA40_ARM64
3943
config TERRAFORM_AWS_FEDORA41_ARM64
4044
bool "Fedora 41 (arm64"
4145

46+
config TERRAFORM_AWS_FEDORA42_ARM64
47+
bool "Fedora 42 (arm64"
48+
4249
endchoice
4350

4451
config TERRAFORM_AWS_NS
4552
string
4653
output yaml
4754
default "Fedora-Cloud-Base-AmazonEC2.aarch64-40-*" if TERRAFORM_AWS_FEDORA40_ARM64
4855
default "Fedora-Cloud-Base-AmazonEC2.aarch64-41-*" if TERRAFORM_AWS_FEDORA41_ARM64
56+
default "Fedora-Cloud-Base-AmazonEC2.aarch64-42-*" if TERRAFORM_AWS_FEDORA42_ARM64
4957

5058
endif # TARGET_ARCH_ARM64
5159

terraform/azure/kconfigs/publishers/Kconfig.rhel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ config TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_5
2727
This option sets the OS image to Red Hat Enterprise Linux
2828
release 9 update 5.
2929

30+
config TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_6
31+
bool "RHEL 9.6 x64"
32+
help
33+
This option sets the OS image to Red Hat Enterprise Linux
34+
release 9 update 6.
35+
3036
endchoice
3137

3238
config TERRAFORM_AZURE_IMAGE_OFFER
@@ -35,13 +41,15 @@ config TERRAFORM_AZURE_IMAGE_OFFER
3541
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_7_9
3642
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_8_9
3743
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_5
44+
default "RHEL" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_6
3845

3946
config TERRAFORM_AZURE_IMAGE_SKU
4047
string
4148
output yaml
4249
default "7_9" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_7_9
4350
default "8_9" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_8_9
4451
default "9_5" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_5
52+
default "9_6" if TERRAFORM_AZURE_IMAGE_LINUX_RHEL_9_6
4553

4654
endif # TARGET_ARCH_X86_64
4755

0 commit comments

Comments
 (0)