blob: cb1c0997b608c02cc457cf4f8bdb91afc18f66fa [file] [log] [blame]
- hosts: undercloud-client
vars_files:
- vars.yaml
tasks:
- name: Create Multipath iSCSI Networks
ansible.builtin.command:
argv: [ "{{ os_venv }}/bin/openstack", "--os-cloud", "openstack-testing", "network", "create", "{{ item }}" ]
loop:
- "{{ network_1 }}"
- "{{ network_2 }}"
- name: Create Multipath iSCSI Subnets
ansible.builtin.command:
argv:
- "{{ os_venv }}/bin/openstack"
- --os-cloud
- openstack-testing
- subnet
- create
- --subnet-range
- "{{ item.ip_range }}"
- --network
- "{{ item.network }}"
- "{{ item.subnet }}"
loop:
- { ip_range: "{{ network_ip_iscsi0 }}", network: "{{ network_1 }}", subnet: "{{ subnet_1 }}" }
- { ip_range: "{{ network_ip_iscsi1 }}", network: "{{ network_2 }}", subnet: "{{ subnet_2 }}" }
# TODO: Support port security
- name: Create the Multipath iSCSI Ports
ansible.builtin.command:
argv:
- "{{ os_venv }}/bin/openstack"
- --os-cloud
- openstack-testing
- port
- create
- --network
- "{{ item.network }}"
- --fixed-ip
- "subnet={{ item.subnet }},ip-address={{ item.ip }}"
- --disable-port-security
- "{{ item.port }}"
loop:
- { network: "{{ network_1 }}", subnet: "{{ subnet_1 }}", ip: "{{ ip_node_1_iscsi0 }}", port: "{{ port_node_1_iscsi0 }}" }
- { network: "{{ network_2 }}", subnet: "{{ subnet_2 }}", ip: "{{ ip_node_1_iscsi1 }}", port: "{{ port_node_1_iscsi1 }}" }
- { network: "{{ network_1 }}", subnet: "{{ subnet_1 }}", ip: "{{ ip_node_2_iscsi0 }}", port: "{{ port_node_2_iscsi0 }}" }
- { network: "{{ network_2 }}", subnet: "{{ subnet_2 }}", ip: "{{ ip_node_2_iscsi1 }}", port: "{{ port_node_2_iscsi1 }}" }
- name: Attach the Multipath iSCSI Ports to the StorPool Node
ansible.builtin.command:
argv: [ "{{ os_venv }}/bin/openstack", "--os-cloud", "openstack-testing", "server", "add", "port", "{{ storpool_node }}", "{{ item }}" ]
loop:
- "{{ port_node_1_iscsi0 }}"
- "{{ port_node_1_iscsi1 }}"
- name: Attach the Multipath iSCSI Ports to the OpenStack Node
ansible.builtin.command:
argv: [ "{{ os_venv }}/bin/openstack", "--os-cloud", "openstack-testing", "server", "add", "port", "{{ openstack_node }}", "{{ item }}" ]
loop:
- "{{ port_node_2_iscsi0 }}"
- "{{ port_node_2_iscsi1 }}"
- name: Get Information About port_node_1_iscsi0
ansible.builtin.command:
argv: [ "{{ os_venv }}/bin/openstack", "--os-cloud", "openstack-testing", "port", "show", "--format", "json", "{{ port_node_1_iscsi0 }}" ]
register: port_node_1_iscsi0_info
- name: Get MAC Address of port_node_1_iscsi0
ansible.builtin.set_fact:
port_node_1_iscsi0_mac: "{{ (port_node_1_iscsi0_info.stdout | from_json).mac_address }}"
- name: Get Information About port_node_1_iscsi1
ansible.builtin.command:
argv: [ "{{ os_venv }}/bin/openstack", "--os-cloud", "openstack-testing", "port", "show", "--format", "json", "{{ port_node_1_iscsi1 }}" ]
register: port_node_1_iscsi1_info
- name: Get MAC Address of port_node_1_iscsi1
ansible.builtin.set_fact:
port_node_1_iscsi1_mac: "{{ (port_node_1_iscsi1_info.stdout | from_json).mac_address }}"
- name: Get Information About port_node_2_iscsi0
ansible.builtin.command:
argv: [ "{{ os_venv }}/bin/openstack", "--os-cloud", "openstack-testing", "port", "show", "--format", "json", "{{ port_node_2_iscsi0 }}" ]
register: port_node_2_iscsi0_info
- name: Get MAC Address of port_node_2_iscsi0
ansible.builtin.set_fact:
port_node_2_iscsi0_mac: "{{ (port_node_2_iscsi0_info.stdout | from_json).mac_address }}"
- name: Get Information About port_node_2_iscsi1
ansible.builtin.command:
argv: [ "{{ os_venv }}/bin/openstack", "--os-cloud", "openstack-testing", "port", "show", "--format", "json", "{{ port_node_2_iscsi1 }}" ]
register: port_node_2_iscsi1_info
- name: Get MAC Address of port_node_2_iscsi1
ansible.builtin.set_fact:
port_node_2_iscsi1_mac: "{{ (port_node_2_iscsi1_info.stdout | from_json).mac_address }}"
- name: Dump Required Information for Next Stage
ansible.builtin.copy:
content: |
port_node_1_iscsi0_mac: {{ port_node_1_iscsi0_mac }}
port_node_1_iscsi1_mac: {{ port_node_1_iscsi1_mac }}
ip_node_1_iscsi0: {{ ip_node_1_iscsi0 }}
ip_node_1_iscsi1: {{ ip_node_1_iscsi1 }}
port_node_2_iscsi0_mac: {{ port_node_2_iscsi0_mac }}
port_node_2_iscsi1_mac: {{ port_node_2_iscsi1_mac }}
ip_node_2_iscsi0: {{ ip_node_2_iscsi0 }}
ip_node_2_iscsi1: {{ ip_node_2_iscsi1 }}
dest: "~/ansivars.yaml"