refactor: consul in first of hashicorp stack

This commit is contained in:
vincent 2024-02-04 21:25:14 +01:00
parent e3d76630c3
commit 73df5fa582

View File

@ -1,4 +1,10 @@
--- ---
- name: Consul install
hosts: all
roles:
- role: ansible-consul
become: true
- name: Vault install - name: Vault install
hosts: homelab hosts: homelab
roles: roles:
@ -9,6 +15,7 @@
ansible.builtin.stat: ansible.builtin.stat:
path: "{{ vault_unseal_keys_dir_output }}/rootkey" path: "{{ vault_unseal_keys_dir_output }}/rootkey"
register: rootkey_exist register: rootkey_exist
delegate_to: localhost
- name: Reading root contents - name: Reading root contents
ansible.builtin.command: cat "{{ vault_unseal_keys_dir_output }}/rootkey" ansible.builtin.command: cat "{{ vault_unseal_keys_dir_output }}/rootkey"
register: root_token register: root_token
@ -37,13 +44,11 @@
nomad_vault_token: "{{ nomad_token_data.login.auth.client_token }}" nomad_vault_token: "{{ nomad_token_data.login.auth.client_token }}"
when: nomad_token_data.login is defined when: nomad_token_data.login is defined
- name: Hashicorp stack - name: nomad
hosts: all hosts: all
vars: vars:
unseal_keys_dir_output: ~/vaultunseal unseal_keys_dir_output: ~/vaultunseal
roles: roles:
- role: ansible-consul
become: true
- role: ansible-nomad - role: ansible-nomad
become: true become: true
- role: docker - role: docker