2024-07-19 21:31:41 +00:00
|
|
|
---
|
|
|
|
# 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 }}"
|
2024-09-02 20:24:58 +00:00
|
|
|
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
|