feat: remove become from role
Some checks failed
test / Linting (push) Failing after 29s
test / Molecule tests (default, debian11) (push) Has been skipped
test / Molecule tests (default, debian12) (push) Has been skipped
test / Molecule tests (default, ubuntu2004) (push) Has been skipped
test / Molecule tests (default, ubuntu2204) (push) Has been skipped
test / Molecule tests (with_custom_config, debian11) (push) Has been skipped
test / Molecule tests (with_custom_config, debian12) (push) Has been skipped
test / Molecule tests (with_custom_config, ubuntu2004) (push) Has been skipped
test / Molecule tests (with_custom_config, ubuntu2204) (push) Has been skipped

This commit is contained in:
Bertrand Lanson 2023-12-03 18:23:33 +01:00
parent ed2c223727
commit 9660328ec7
15 changed files with 17 additions and 32 deletions

View File

@ -3,20 +3,17 @@
- name: "Reload service file"
ansible.builtin.systemd:
daemon_reload: true
become: true
listen: "systemctl-daemon-reload"
- name: "Enable vault-certs service"
ansible.builtin.service:
name: vault-certs
enabled: true
become: true
listen: "systemctl-enable-vault-certs"
- name: "Start vault-certs service"
ansible.builtin.service:
name: vault-certs
state: restarted
become: true
listen: "systemctl-restart-vault-certs"
when: renew_vault_certificates_start_service

View File

@ -1,6 +1,7 @@
---
- name: Converge
hosts: all
become: true
tasks:
- name: "Include ednxzu.renew_vault_certificates"
ansible.builtin.include_role:

View File

@ -1,12 +1,12 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: "Create group vault"
ansible.builtin.group:
name: "vault"
state: present
become: true
- name: "Create user vault"
ansible.builtin.user:
@ -14,4 +14,3 @@
group: "vault"
shell: /bin/false
state: present
become: true

View File

@ -2,6 +2,7 @@
- name: Verify
hosts: all
gather_facts: true
become: true
tasks:
- name: "Test: directory /etc/consul-template.d/vault"
block:
@ -19,7 +20,6 @@
ansible.builtin.slurp:
src: "/etc/consul-template.d/vault/vault_config.hcl"
register: slurp_etc_consul_template_d_vault_vault_config_hcl
become: true
- name: "Verify directory /etc/consul-template.d/vault"
ansible.builtin.assert:
@ -60,7 +60,6 @@
src: "{{ item.path }}"
loop: "{{ find_etc_consul_template_d_vault_templates.files }}"
register: slurp_etc_consul_template_d_vault_templates
become: true
- name: "Verify file /etc/consul-template.d/vault/templates/vault_cert.pem.tpl"
vars:
@ -109,9 +108,8 @@
ansible.builtin.slurp:
src: "/etc/systemd/system/vault-certs.service"
register: slurp_etc_systemd_system_vault_certs_service
become: true
- name: "Verify service vault"
- name: "Verify service vault-certs"
ansible.builtin.assert:
that:
- stat_etc_systemd_system_vault_certs_service.stat.exists

View File

@ -1,6 +1,7 @@
---
- name: Converge
hosts: all
become: true
tasks:
- name: "Include ednxzu.renew_vault_certificates"
ansible.builtin.include_role:

View File

@ -1,12 +1,12 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: "Create group vault"
ansible.builtin.group:
name: "vault"
state: present
become: true
- name: "Create user vault"
ansible.builtin.user:
@ -14,4 +14,3 @@
group: "vault"
shell: /bin/false
state: present
become: true

View File

@ -2,6 +2,7 @@
- name: Verify
hosts: all
gather_facts: true
become: true
tasks:
- name: "Test: directory /etc/consul-template.d/vault"
block:
@ -19,7 +20,6 @@
ansible.builtin.slurp:
src: "/etc/consul-template.d/vault/vault_config.hcl"
register: slurp_etc_consul_template_d_vault_vault_config_hcl
become: true
- name: "Verify directory /etc/consul-template.d/vault"
ansible.builtin.assert:
@ -60,7 +60,6 @@
src: "{{ item.path }}"
loop: "{{ find_etc_consul_template_d_vault_templates.files }}"
register: slurp_etc_consul_template_d_vault_templates
become: true
- name: "Verify file /etc/consul-template.d/vault/templates/vault_cert.pem.tpl"
vars:
@ -109,9 +108,8 @@
ansible.builtin.slurp:
src: "/etc/systemd/system/vault-certs.service"
register: slurp_etc_systemd_system_vault_certs_service
become: true
- name: "Verify service vault"
- name: "Verify service vault-certs"
ansible.builtin.assert:
that:
- stat_etc_systemd_system_vault_certs_service.stat.exists

View File

@ -1,6 +1,7 @@
---
- name: Converge
hosts: all
become: true
tasks:
- name: "Include ednxzu.renew_vault_certificates"
ansible.builtin.include_role:

View File

@ -1,12 +1,12 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: "Create group vault"
ansible.builtin.group:
name: "vault"
state: present
become: true
- name: "Create user vault"
ansible.builtin.user:
@ -14,4 +14,3 @@
group: "vault"
shell: /bin/false
state: present
become: true

View File

@ -2,6 +2,7 @@
- name: Verify
hosts: all
gather_facts: true
become: true
tasks:
- name: "Test: directory /etc/consul-template.d/vault"
block:
@ -19,7 +20,6 @@
ansible.builtin.slurp:
src: "/etc/consul-template.d/vault/vault_config.hcl"
register: slurp_etc_consul_template_d_vault_vault_config_hcl
become: true
- name: "Verify directory /etc/consul-template.d/vault"
ansible.builtin.assert:
@ -60,7 +60,6 @@
src: "{{ item.path }}"
loop: "{{ find_etc_consul_template_d_vault_templates.files }}"
register: slurp_etc_consul_template_d_vault_templates
become: true
- name: "Verify file /etc/consul-template.d/vault/templates/vault_cert.pem.tpl"
vars:
@ -109,9 +108,8 @@
ansible.builtin.slurp:
src: "/etc/systemd/system/vault-certs.service"
register: slurp_etc_systemd_system_vault_certs_service
become: true
- name: "Verify service vault"
- name: "Verify service vault-certs"
ansible.builtin.assert:
that:
- stat_etc_systemd_system_vault_certs_service.stat.exists

View File

@ -1,6 +1,7 @@
---
- name: Converge
hosts: all
become: true
tasks:
- name: "Include ednxzu.renew_vault_certificates"
ansible.builtin.include_role:

View File

@ -1,12 +1,12 @@
---
- name: Prepare
hosts: all
become: true
tasks:
- name: "Create group vault"
ansible.builtin.group:
name: "vault"
state: present
become: true
- name: "Create user vault"
ansible.builtin.user:
@ -14,4 +14,4 @@
group: "vault"
shell: /bin/false
state: present
become: true

View File

@ -2,6 +2,7 @@
- name: Verify
hosts: all
gather_facts: true
become: true
tasks:
- name: "Test: directory /etc/consul-template.d/vault"
block:
@ -19,7 +20,6 @@
ansible.builtin.slurp:
src: "/etc/consul-template.d/vault/vault_config.hcl"
register: slurp_etc_consul_template_d_vault_vault_config_hcl
become: true
- name: "Verify directory /etc/consul-template.d/vault"
ansible.builtin.assert:
@ -60,7 +60,6 @@
src: "{{ item.path }}"
loop: "{{ find_etc_consul_template_d_vault_templates.files }}"
register: slurp_etc_consul_template_d_vault_templates
become: true
- name: "Verify file /etc/consul-template.d/vault/templates/vault_cert.pem.tpl"
vars:
@ -109,9 +108,8 @@
ansible.builtin.slurp:
src: "/etc/systemd/system/vault-certs.service"
register: slurp_etc_systemd_system_vault_certs_service
become: true
- name: "Verify service vault"
- name: "Verify service vault-certs"
ansible.builtin.assert:
that:
- stat_etc_systemd_system_vault_certs_service.stat.exists

View File

@ -1,7 +1,6 @@
---
# task/configure file for renew_vault_certificates
- name: "Configure files for vault certificate renewal"
become: true
notify:
- "systemctl-enable-vault-certs"
- "systemctl-restart-vault-certs"
@ -37,6 +36,5 @@
owner: root
group: root
mode: '0644'
become: true
notify:
- "systemctl-daemon-reload"

View File

@ -7,7 +7,6 @@
owner: "{{ renew_vault_certificates_vault_user }}"
group: "{{ renew_vault_certificates_vault_group }}"
mode: '0755'
become: true
- name: "Create directory templates directory in {{ renew_vault_certificates_config_dir }}"
ansible.builtin.file:
@ -16,7 +15,6 @@
owner: "{{ renew_vault_certificates_vault_user }}"
group: "{{ renew_vault_certificates_vault_group }}"
mode: '0755'
become: true
- name: "Ensure certificate/key directory(ies) exist(s)"
ansible.builtin.file:
@ -25,7 +23,6 @@
owner: "{{ renew_vault_certificates_vault_user }}"
group: "{{ renew_vault_certificates_vault_group }}"
mode: '0755'
become: true
loop:
- "{{ renew_vault_certificates_cert_dest }}"
- "{{ renew_vault_certificates_key_dest }}"