Skip to content

Commit a0f7b52

Browse files
committed
base_image: add missing become privileges for custom image tasks
Fix permission errors when using system libvirt by adding missing become privileges to tasks that write to system directories: - Fetch the custom image task - Fetch the sha512sums file task - Touch the custom image sentinel task - Build the custom index task - Generate the index repository task These tasks failed with "Destination not writable" errors because they were running as user but needed to write to root-owned directories in /var/lib/libvirt/images/ when using system libvirt. Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]>
1 parent ffd47f8 commit a0f7b52

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

playbooks/roles/base_image/tasks/custom-image.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
register: custom_image_stat
3636

3737
- name: Fetch the custom image
38+
become: true
39+
become_method: ansible.builtin.sudo
3840
ansible.builtin.get_url:
3941
url: "{{ guestfs_custom_raw_image_url }}"
4042
dest: "{{ custom_image_dir }}"
@@ -73,6 +75,8 @@
7375
register: sha512sums_stat
7476

7577
- name: Fetch the sha512sums file
78+
become: true
79+
become_method: ansible.builtin.sudo
7680
ansible.builtin.get_url:
7781
url: "{{ guestfs_custom_raw_image_sha512sums_url }}"
7882
dest: "{{ custom_image_dir }}"
@@ -159,6 +163,8 @@
159163
- not sentinel_stat.stat.exists
160164

161165
- name: Touch the custom image sentinel
166+
become: true
167+
become_method: ansible.builtin.sudo
162168
ansible.builtin.file:
163169
path: "{{ custom_image_ok }}"
164170
state: touch
@@ -190,6 +196,8 @@
190196
register: custom_index_stat
191197

192198
- name: Build the custom index
199+
become: true
200+
become_method: ansible.builtin.sudo
193201
ansible.builtin.template:
194202
src: "{{ role_path }}/templates/custom-index.j2"
195203
dest: "{{ custom_index }}"
@@ -225,6 +233,8 @@
225233
Custom virt-builder image: {{ custom_image }}
226234
227235
- name: Generating the index for {{ base_image_os_version }}
236+
become: true
237+
become_method: ansible.builtin.sudo
228238
ansible.builtin.command:
229239
argv:
230240
- "virt-builder-repository"

0 commit comments

Comments
 (0)