Rename variable.

This commit is contained in:
yohan 2024-03-22 15:08:04 +01:00
parent 18ab562cae
commit a1a1eba282

View File

@ -1,17 +1,17 @@
--- ---
- name: Create /mnt/volumes/{{ item.name }} directory - name: Create /mnt/volumes/{{ volume.name }} directory
ansible.builtin.file: ansible.builtin.file:
path: "/mnt/volumes/{{ item.name }}" path: "/mnt/volumes/{{ volume.name }}"
state: directory state: directory
mode: '0755' mode: '0755'
become: true become: true
- name: Create {{ item.name }} volume - name: Create {{ volume.name }} volume
openstack.cloud.volume: openstack.cloud.volume:
state: present state: present
size: "{{ item.size }}" size: "{{ volume.size }}"
volume_type: "{{ item.vol_type }}" volume_type: "{{ volume.vol_type }}"
name: "{{ target_name.split('.')[0] }}-{{ item.name }}" name: "{{ target_name.split('.')[0] }}-{{ volume.name }}"
environment: environment:
OS_AUTH_URL: "{{ OS_AUTH_URL }}" OS_AUTH_URL: "{{ OS_AUTH_URL }}"
OS_IDENTITY_API_VERSION: "{{ OS_IDENTITY_API_VERSION }}" OS_IDENTITY_API_VERSION: "{{ OS_IDENTITY_API_VERSION }}"
@ -23,11 +23,11 @@
OS_PASSWORD: "{{ OS_PASSWORD }}" OS_PASSWORD: "{{ OS_PASSWORD }}"
OS_REGION_NAME: "{{ OS_REGION_NAME }}" OS_REGION_NAME: "{{ OS_REGION_NAME }}"
- name: Attach {{ item.name }} volume to instance - name: Attach {{ volume.name }} volume to instance
openstack.cloud.server_volume: openstack.cloud.server_volume:
state: present state: present
server: "{{ target_name }}" server: "{{ target_name }}"
volume: "{{ target_name.split('.')[0] }}-{{ item.name }}" volume: "{{ target_name.split('.')[0] }}-{{ volume.name }}"
environment: environment:
OS_AUTH_URL: "{{ OS_AUTH_URL }}" OS_AUTH_URL: "{{ OS_AUTH_URL }}"
OS_IDENTITY_API_VERSION: "{{ OS_IDENTITY_API_VERSION }}" OS_IDENTITY_API_VERSION: "{{ OS_IDENTITY_API_VERSION }}"
@ -40,23 +40,23 @@
OS_REGION_NAME: "{{ OS_REGION_NAME }}" OS_REGION_NAME: "{{ OS_REGION_NAME }}"
register: volume_output register: volume_output
- name: Create a ext4 filesystem on {{ item.name }} volume - name: Create a ext4 filesystem on {{ volume.name }} volume
community.general.filesystem: community.general.filesystem:
fstype: ext4 fstype: ext4
dev: "{{ volume_output.attachments[0].device }}" dev: "{{ volume_output.attachments[0].device }}"
become: true become: true
- name: mount /mnt/volumes/{{ item.name }} - name: mount /mnt/volumes/{{ volume.name }}
ansible.posix.mount: ansible.posix.mount:
path: "/mnt/volumes/{{ item.name }}" path: "/mnt/volumes/{{ volume.name }}"
src: "{{ volume_output.attachments[0].device }}" src: "{{ volume_output.attachments[0].device }}"
fstype: ext4 fstype: ext4
state: mounted state: mounted
become: true become: true
- name: Create /mnt/volumes/{{ item.name }}/data directory - name: Create /mnt/volumes/{{ volume.name }}/data directory
ansible.builtin.file: ansible.builtin.file:
path: "/mnt/volumes/{{ item.name }}/data" path: "/mnt/volumes/{{ volume.name }}/data"
state: directory state: directory
mode: '0755' mode: '0755'
become: true become: true