hcp-ansible/roles/vault/tasks/main.yml
Bertrand Lanson 66a4f6b5da
All checks were successful
development / Check commit compliance (push) Successful in 25s
pull-requests-open / Check commit compliance (pull_request) Successful in 32s
feat(vault): enable rolling restart with no full seal
2024-09-02 22:24:58 +02:00

46 lines
1.4 KiB
YAML

---
# task/main file for hashicorp_vault
- name: "Vault | Set reload-check & restart-check variable"
ansible.builtin.set_fact:
_vault_service_need_reload: false
_vault_service_need_restart: false
- name: "Vault | Import merge_variables.yml"
ansible.builtin.include_tasks: merge_variables.yml
- name: "Vault | Import prerequisites.yml"
ansible.builtin.include_tasks: prerequisites.yml
- name: "Vault | Import install.yml"
ansible.builtin.include_tasks: "install.yml"
- name: "Vault | Import configure.yml"
ansible.builtin.include_tasks: configure.yml
- name: "Vault | Populate service facts"
ansible.builtin.service_facts:
- name: "Vault | Set restart-check variable"
ansible.builtin.set_fact:
_vault_service_need_restart: true
when: ansible_facts.services[vault_service_name~'.service'].state != 'running'
- name: "Vault | Enable service: {{ vault_service_name }}"
ansible.builtin.service:
name: "{{ vault_service_name }}"
enabled: true
- name: "Vault | Reload systemd daemon"
ansible.builtin.systemd:
daemon_reload: true
when: _vault_service_need_reload
- name: "Vault | Start service: {{ vault_service_name }}"
ansible.builtin.include_tasks: rolling_restart.yml
when:
- _vault_service_need_restart
- "hostvars[host_item].inventory_hostname == inventory_hostname"
with_items: "{{ ansible_play_batch }}"
loop_control:
loop_var: host_item