diff mbox series

[05/12] ansible: Add build-deps tag

Message ID 20241218-jag-bringup_fixes-v1-5-0bf2e07c640c@kernel.org (mailing list archive)
State New
Headers show
Series kdevops: Various fixes | expand

Commit Message

Joel Granados Dec. 18, 2024, 10:29 a.m. UTC
Add build-deps tag to enable-user and install-deps tasks in libvirt_user
role so they can be used from other roles. With no tags, these tasks are
skipped.

Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
 playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml | 6 +++++-
 playbooks/roles/libvirt_user/tasks/enable-user/main.yml        | 4 ++++
 playbooks/roles/libvirt_user/tasks/install-deps/main.yml       | 7 +++++++
 scripts/guestfs.Makefile                                       | 2 +-
 4 files changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml b/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml
index 1ad7f17..5797bd6 100644
--- a/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml
+++ b/playbooks/roles/libvirt_user/tasks/enable-user/debian/main.yml
@@ -9,12 +9,14 @@ 
   when:
     - not libvirt_session
     - not only_verify_user|bool
+  tags: [ 'build-deps' ]
 
 - name: Check if apparmor_status exists
   stat:
     path: /usr/sbin/apparmor_status
   register: apparmor_file_stat_result
   when: 'only_verify_user|bool'
+  tags: [ 'build-deps' ]
 
 - name: Verify if AppArmor is disabled when applicable
   become: yes
@@ -26,6 +28,7 @@ 
   when:
     - 'only_verify_user|bool'
     - 'apparmor_file_stat_result.stat.exists'
+  tags: [ 'build-deps' ]
 
 - name: Verifies user's effective group allows to run libvirt/kvm without being root
   shell: groups | grep {{ item }}
@@ -41,9 +44,10 @@ 
   when:
     - not libvirt_session
     - not only_verify_user|bool
+  tags: [ 'build-deps' ]
 
 - name: Ensure our user is part of the libvirt/kvm groups
-  tags: [ 'journal' ]
+  tags: [ 'journal', 'build-deps' ]
   become: yes
   become_flags: 'su - -c'
   become_method: sudo
diff --git a/playbooks/roles/libvirt_user/tasks/enable-user/main.yml b/playbooks/roles/libvirt_user/tasks/enable-user/main.yml
index 04f8e31..364d625 100644
--- a/playbooks/roles/libvirt_user/tasks/enable-user/main.yml
+++ b/playbooks/roles/libvirt_user/tasks/enable-user/main.yml
@@ -2,19 +2,23 @@ 
 - name: Debian-specific set up
   ansible.builtin.include_tasks: install-deps/debian/main.yml
   when: ansible_os_family == 'Debian'
+  tags: [ 'build-deps' ]
 
 - name: SuSE-specific set up
   ansible.builtin.include_tasks: install-deps/suse/main.yml
   when: ansible_os_family == 'Suse'
+  tags: [ 'build-deps' ]
 
 - name: Red Hat-specific set up
   ansible.builtin.include_tasks: install-deps/redhat/main.yml
   when:
     - ansible_os_family == 'RedHat'
     - ansible_facts['distribution'] != "Fedora"
+  tags: [ 'build-deps' ]
 
 - name: Fedora-specific set up
   ansible.builtin.include_tasks: install-deps/fedora/main.yml
   when:
     - ansible_os_family == 'RedHat'
     - ansible_facts['distribution'] == "Fedora"
+  tags: [ 'build-deps' ]
diff --git a/playbooks/roles/libvirt_user/tasks/install-deps/main.yml b/playbooks/roles/libvirt_user/tasks/install-deps/main.yml
index c652ab2..c2f58c8 100644
--- a/playbooks/roles/libvirt_user/tasks/install-deps/main.yml
+++ b/playbooks/roles/libvirt_user/tasks/install-deps/main.yml
@@ -11,11 +11,18 @@ 
 - name: Distribution specific setup
   import_tasks: debian/main.yml
   when: ansible_facts['os_family']|lower == 'debian'
+  tags: [ 'build-deps' ]
+
 - import_tasks: suse/main.yml
   when: ansible_facts['os_family']|lower == 'suse'
+  tags: [ 'build-deps' ]
+
 - import_tasks: redhat/main.yml
   when:
     - ansible_facts['os_family']|lower == 'redhat'
     - ansible_facts['distribution']|lower != "fedora"
+  tags: [ 'build-deps' ]
+
 - import_tasks: fedora/main.yml
   when: ansible_facts['distribution']|lower == "fedora"
+  tags: [ 'build-deps' ]
diff --git a/scripts/guestfs.Makefile b/scripts/guestfs.Makefile
index 52397d5..dbfb372 100644
--- a/scripts/guestfs.Makefile
+++ b/scripts/guestfs.Makefile
@@ -78,7 +78,7 @@  bringup_guestfs: $(GUESTFS_BRINGUP_DEPS)
 		playbooks/bringup_guestfs.yml \
 		-e 'ansible_python_interpreter=/usr/bin/python3' \
 		--extra-vars=@./extra_vars.yaml \
-		--tags config-check,network
+		--tags config-check,network,build-deps
 	$(Q)$(TOPDIR)/scripts/bringup_guestfs.sh
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) --connection=local \
 		--inventory localhost, \