diff --git a/ansible/roles/cinder/tasks/config.yml b/ansible/roles/cinder/tasks/config.yml index 8e430755baebfa1ac0b96b1aedaed00991d88d17..493ebb6a5655d1a152e4c1002572a3822d690d43 100644 --- a/ansible/roles/cinder/tasks/config.yml +++ b/ansible/roles/cinder/tasks/config.yml @@ -92,6 +92,21 @@ notify: - "Restart {{ item.key }} container" +- name: Generating 'hostnqn' file for cinder_volume + vars: + service: "{{ cinder_services['cinder-volume'] }}" + hostnqn: "nqn.2014-08.org.nvmexpress:uuid:{{ ansible_facts.hostname | to_uuid }}" + template: + src: "templates/hostnqn.j2" + dest: "{{ node_config_directory }}/cinder-volume/hostnqn" + mode: "0660" + become: true + when: + - inventory_hostname in groups[service.group] + - service.enabled | bool + notify: + - Restart cinder-volume container + - name: Copying over existing policy file become: true template: diff --git a/ansible/roles/cinder/templates/cinder-volume.json.j2 b/ansible/roles/cinder/templates/cinder-volume.json.j2 index 2a4463baea1705f6cce515969fefebf0ed42eb7b..1017bf806e07c31596251f2b037b966d08a13270 100644 --- a/ansible/roles/cinder/templates/cinder-volume.json.j2 +++ b/ansible/roles/cinder/templates/cinder-volume.json.j2 @@ -19,6 +19,12 @@ "owner": "cinder", "perm": "0600", "optional": {{ (not enable_cinder_backend_nfs | bool) | string | lower }} + }, + { + "source": "{{ container_config_directory }}/hostnqn", + "dest": "/etc/nvme/hostnqn", + "owner": "root", + "perm": "0644" }{% if cinder_policy_file is defined %}, { "source": "{{ container_config_directory }}/{{ cinder_policy_file }}", diff --git a/ansible/roles/cinder/templates/hostnqn.j2 b/ansible/roles/cinder/templates/hostnqn.j2 new file mode 100644 index 0000000000000000000000000000000000000000..6f10135974b328cb6724a4a74a5ef31b65bddb13 --- /dev/null +++ b/ansible/roles/cinder/templates/hostnqn.j2 @@ -0,0 +1 @@ +{{ hostnqn }} diff --git a/ansible/roles/nova-cell/tasks/config.yml b/ansible/roles/nova-cell/tasks/config.yml index d4410b51e94528bb9f0148af51a4a30bddd0aa00..1618652bfa8dfb5c3372a5ca24d5a46220fb99c3 100644 --- a/ansible/roles/nova-cell/tasks/config.yml +++ b/ansible/roles/nova-cell/tasks/config.yml @@ -200,6 +200,21 @@ notify: - Restart nova-compute container +- name: Generating 'hostnqn' file for nova_compute + vars: + hostnqn: "nqn.2014-08.org.nvmexpress:uuid:{{ ansible_facts.hostname | to_uuid }}" + service: "{{ nova_cell_services['nova-compute'] }}" + template: + src: "templates/hostnqn.j2" + dest: "{{ node_config_directory }}/nova-compute/hostnqn" + mode: "0660" + become: true + when: + - inventory_hostname in groups[service.group] + - service.enabled | bool + notify: + - Restart nova-compute container + - name: Copying over existing policy file become: true template: diff --git a/ansible/roles/nova-cell/templates/hostnqn.j2 b/ansible/roles/nova-cell/templates/hostnqn.j2 new file mode 100644 index 0000000000000000000000000000000000000000..6f10135974b328cb6724a4a74a5ef31b65bddb13 --- /dev/null +++ b/ansible/roles/nova-cell/templates/hostnqn.j2 @@ -0,0 +1 @@ +{{ hostnqn }} diff --git a/ansible/roles/nova-cell/templates/nova-compute.json.j2 b/ansible/roles/nova-cell/templates/nova-compute.json.j2 index a6b5bc554cf9c1d3160064fea07a4bc05b442d7c..1069c541d0d2cad1f94a092e53a7ed6cb617053a 100644 --- a/ansible/roles/nova-cell/templates/nova-compute.json.j2 +++ b/ansible/roles/nova-cell/templates/nova-compute.json.j2 @@ -55,6 +55,12 @@ "owner": "nova", "perm": "0600", "optional": true + }, + { + "source": "{{ container_config_directory }}/hostnqn", + "dest": "/etc/nvme/hostnqn", + "owner": "root", + "perm": "0644" }{% if nova_compute_virt_type in ['kvm', 'qemu'] and libvirt_enable_sasl | bool %}, { "source": "{{ container_config_directory }}/auth.conf",