feat: add become statements to avoid relying on ansible.cfg
All checks were successful
test / Linting (push) Successful in 9s
test / Molecule tests (default, debian11) (push) Successful in 1m13s
test / Molecule tests (default, debian12) (push) Successful in 1m21s
test / Molecule tests (default, ubuntu2004) (push) Successful in 1m24s
test / Molecule tests (with_custom_repo, debian11) (push) Successful in 55s
test / Molecule tests (with_custom_repo, debian12) (push) Successful in 54s
test / Molecule tests (with_custom_repo, ubuntu2004) (push) Successful in 1m0s
test / Molecule tests (with_custom_repo, ubuntu2204) (push) Successful in 58s
test / Molecule tests (default, ubuntu2204) (push) Successful in 50s

This commit is contained in:
Bertrand Lanson 2023-11-27 20:59:30 +01:00
parent 38b95870f0
commit 66ff9d0c20
2 changed files with 6 additions and 0 deletions

View File

@ -9,6 +9,7 @@
when: item.options is defined
and item.options['Signed-By'] is defined
and item.options['Signed-By'] not in [None, '']
become: true
- name: "Configure custom repositories"
vars:
@ -20,5 +21,6 @@
owner: root
group: root
loop: "{{ manage_repositories_custom_repo }}"
become: true
notify:
- "debian-based-cache-update"

View File

@ -7,6 +7,7 @@
src: "{{ manage_repositories_sources_list_location }}"
register: sources_list_current_content
ignore_errors: true
become: true
- name: "Convert sources.list current content to string"
ansible.builtin.set_fact:
@ -24,6 +25,7 @@
group: root
mode: '0644'
when: sources_list_current_content_str == ''
become: true
- name: "Replace content of /etc/apt/sources.list"
ansible.builtin.replace:
@ -31,6 +33,7 @@
regexp: "{{ sources_list_current_content_str | regex_escape }}"
replace: "{{ sources_list_new_content }}"
when: sources_list_current_content_str != sources_list_new_content
become: true
- name: "Configure main repositories into sources.list.d for {{ ansible_distribution|lower }} "
ansible.builtin.deb822_repository:
@ -40,5 +43,6 @@
suites: "{{ item.suites | join(' ') }}"
components: "{{ item.components }}"
loop: "{{ manage_repositories_default_repo }}"
become: true
notify:
- "debian-based-cache-update"