|
21 | 21 | gather_facts: true
|
22 | 22 | hosts: controllers
|
23 | 23 | vars:
|
24 |
| - openbao_bind_address: "{{ internal_net_name | net_ip }}" |
| 24 | + openbao_bind_addr: "{{ internal_net_name | net_ip }}" |
| 25 | + # This is the IP address of the first controller and therefore the leader within |
| 26 | + # OpenBao. This could be replaced with the VIP address of the internal network if |
| 27 | + # HAProxy has been configured to load balance the OpenBao API. |
| 28 | + openbao_raft_leaders: |
| 29 | + - "{{ internal_net_name | net_ip(inventory_hostname=groups['controllers'][0]) }}" |
25 | 30 | tasks:
|
26 | 31 | - name: Set a fact about the virtualenv on the remote system
|
27 | 32 | ansible.builtin.set_fact:
|
|
46 | 51 |
|
47 | 52 | - name: Template out TLS key and cert
|
48 | 53 | ansible.builtin.copy:
|
49 |
| - # Within the OpenBao container these uids & gids map to the vault user |
| 54 | + # Within the OpenBao container these uids & gids map to the openbao user |
50 | 55 | src: "{{ kayobe_env_config_path }}/openbao/{{ item }}"
|
51 | 56 | dest: /opt/kayobe/openbao/{{ item }}
|
52 | 57 | owner: 100
|
|
55 | 60 | loop:
|
56 | 61 | - "{% if kolla_internal_fqdn != kolla_internal_vip_address %}{{ kolla_internal_fqdn }}{% else %}overcloud{% endif %}.crt"
|
57 | 62 | - "{% if kolla_internal_fqdn != kolla_internal_vip_address %}{{ kolla_internal_fqdn }}{% else %}overcloud{% endif %}.key"
|
| 63 | + - "OS-TLS-INT.crt" |
58 | 64 | become: true
|
59 | 65 |
|
60 | 66 | - name: Apply OpenBao role
|
|
71 | 77 | openbao_docker_tag: "{{ overcloud_openbao_docker_tag }}"
|
72 | 78 | openbao_tls_cert: "{% if kolla_internal_fqdn != kolla_internal_vip_address %}{{ kolla_internal_fqdn }}{% else %}overcloud{% endif %}.crt"
|
73 | 79 | openbao_tls_key: "{% if kolla_internal_fqdn != kolla_internal_vip_address %}{{ kolla_internal_fqdn }}{% else %}overcloud{% endif %}.key"
|
| 80 | + openbao_tls_ca: "OS-TLS-INT.crt" |
74 | 81 | copy_self_signed_ca: true
|
75 | 82 | openbao_api_addr: https://{{ internal_net_name | net_ip }}:8200
|
76 | 83 | openbao_write_keys_file: true
|
|
91 | 98 | vault_unseal_keys: "{{ openbao_keys.keys_base64 }}"
|
92 | 99 | environment:
|
93 | 100 | https_proxy: ""
|
| 101 | + run_once: true |
| 102 | + |
| 103 | + # As the first instance is now unsealed the other instances will now need some |
| 104 | + # time to connect before we can proceed. |
| 105 | + - name: Wait for OpenBao Raft peers to connect |
| 106 | + ansible.builtin.wait_for: |
| 107 | + timeout: 30 |
| 108 | + delegate_to: localhost |
| 109 | + |
| 110 | + # Raft peers take few seconds before they report an unsealed state therefore |
| 111 | + # we must wait. |
| 112 | + - name: Unseal OpenBao |
| 113 | + ansible.builtin.import_role: |
| 114 | + name: stackhpc.hashicorp.vault_unseal |
| 115 | + vars: |
| 116 | + vault_api_addr: https://{{ internal_net_name | net_ip }}:8200 |
| 117 | + vault_unseal_token: "{{ openbao_keys.root_token }}" |
| 118 | + vault_unseal_ca_cert: "{{ '/etc/pki/tls/certs/ca-bundle.crt' if ansible_facts.os_family == 'RedHat' else '/usr/local/share/ca-certificates/OS-TLS-ROOT.crt' }}" |
| 119 | + vault_unseal_keys: "{{ openbao_keys.keys_base64 }}" |
| 120 | + vault_unseal_timeout: 10 |
| 121 | + environment: |
| 122 | + https_proxy: "" |
94 | 123 |
|
95 | 124 | - name: Configure PKI
|
96 | 125 | any_errors_fatal: true
|
|
0 commit comments