diff --git a/ansible/roles/cinder/tasks/external_ceph.yml b/ansible/roles/cinder/tasks/external_ceph.yml index 03a7a7fe8d..c4da309d28 100644 --- a/ansible/roles/cinder/tasks/external_ceph.yml +++ b/ansible/roles/cinder/tasks/external_ceph.yml @@ -20,7 +20,7 @@ - Restart {{ item.key }} container - name: Copy over Ceph keyring files for cinder-volume - copy: + template: src: "{{ node_custom_config }}/cinder/cinder-volume/{{ ceph_cinder_keyring }}" dest: "{{ node_config_directory }}/cinder-volume/" mode: "0660" @@ -33,7 +33,7 @@ - Restart cinder-volume container - name: Copy over Ceph keyring files for cinder-backup - copy: + template: src: "{{ node_custom_config }}/cinder/{{ item }}" dest: "{{ node_config_directory }}/cinder-backup/" mode: "0660" diff --git a/ansible/roles/glance/tasks/external_ceph.yml b/ansible/roles/glance/tasks/external_ceph.yml index 8f35332259..a37e896888 100644 --- a/ansible/roles/glance/tasks/external_ceph.yml +++ b/ansible/roles/glance/tasks/external_ceph.yml @@ -10,7 +10,7 @@ - Restart glance-api container - name: Copy over ceph Glance keyring - copy: + template: src: "{{ node_custom_config }}/glance/{{ ceph_glance_keyring }}" dest: "{{ node_config_directory }}/glance-api/{{ ceph_glance_keyring }}" mode: "0660" diff --git a/ansible/roles/gnocchi/tasks/external_ceph.yml b/ansible/roles/gnocchi/tasks/external_ceph.yml index 01df7b167b..1f36b2483c 100644 --- a/ansible/roles/gnocchi/tasks/external_ceph.yml +++ b/ansible/roles/gnocchi/tasks/external_ceph.yml @@ -13,7 +13,7 @@ - Restart {{ item.key }} container - name: Copy over ceph gnocchi keyring - copy: + template: src: "{{ node_custom_config }}/gnocchi/{{ ceph_gnocchi_keyring }}" dest: "{{ node_config_directory }}/{{ item.key }}/{{ ceph_gnocchi_keyring }}" mode: "0660" diff --git a/ansible/roles/manila/tasks/external_ceph.yml b/ansible/roles/manila/tasks/external_ceph.yml index c6f3bac771..7eedc5d3fa 100644 --- a/ansible/roles/manila/tasks/external_ceph.yml +++ b/ansible/roles/manila/tasks/external_ceph.yml @@ -11,7 +11,7 @@ - Restart manila-share container - name: Copy over Ceph keyring files for manila - copy: + template: src: "{{ node_custom_config }}/manila/{{ ceph_manila_keyring }}" dest: "{{ node_config_directory }}/manila-share/{{ ceph_manila_keyring }}" mode: "0600" diff --git a/ansible/roles/nova-cell/tasks/external_ceph.yml b/ansible/roles/nova-cell/tasks/external_ceph.yml index 302880e4ec..d283f5547a 100644 --- a/ansible/roles/nova-cell/tasks/external_ceph.yml +++ b/ansible/roles/nova-cell/tasks/external_ceph.yml @@ -32,7 +32,7 @@ - external_ceph_cephx_enabled | bool - name: Copy over ceph nova keyring file - copy: + template: src: "{{ nova_cephx_keyring_file.stat.path }}" dest: "{{ node_config_directory }}/{{ item }}/" mode: "0660" @@ -47,7 +47,7 @@ - Restart {{ item }} container - name: Copy over ceph cinder keyring file - copy: + template: src: "{{ cinder_cephx_keyring_file.stat.path }}" dest: "{{ node_config_directory }}/{{ item }}/" mode: "0660" @@ -98,7 +98,7 @@ - name: Extract nova key from file set_fact: nova_cephx_raw_key: - "{{ lookup('file', nova_cephx_keyring_file.stat.path) | regex_search('key\\s*=.*$', multiline=True) | regex_replace('key\\s*=\\s*(.*)\\s*', '\\1') }}" + "{{ lookup('template', nova_cephx_keyring_file.stat.path) | regex_search('key\\s*=.*$', multiline=True) | regex_replace('key\\s*=\\s*(.*)\\s*', '\\1') }}" changed_when: false run_once: True when: @@ -108,7 +108,7 @@ - name: Extract cinder key from file set_fact: cinder_cephx_raw_key: - "{{ lookup('file', cinder_cephx_keyring_file.stat.path) | regex_search('key\\s*=.*$', multiline=True) | regex_replace('key\\s*=\\s*(.*)\\s*', '\\1') }}" + "{{ lookup('template', cinder_cephx_keyring_file.stat.path) | regex_search('key\\s*=.*$', multiline=True) | regex_replace('key\\s*=\\s*(.*)\\s*', '\\1') }}" changed_when: false run_once: True when: diff --git a/releasenotes/notes/external-ceph-variables-123093dceb1049b7.yaml b/releasenotes/notes/external-ceph-variables-123093dceb1049b7.yaml new file mode 100644 index 0000000000..61b82c31b0 --- /dev/null +++ b/releasenotes/notes/external-ceph-variables-123093dceb1049b7.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Allows the use of variables in ceph conf and keyring files. + Consistently use template instead of copy. This has the added + advantage of allowing variables inside ceph conf files and keyrings. + Including but not limited to ansible lookup expressions. + `LP#1959565 `__