Move iSCSI config to the iSCSI playbooks
Change-Id: Id16bd2fa16933112c77b3084b3c925c60ba47f25
diff --git a/playbooks/setup-openstack-iscsi-multipath/pre.yaml b/playbooks/setup-openstack-iscsi-multipath/pre.yaml
index cb1c099..a48486b 100644
--- a/playbooks/setup-openstack-iscsi-multipath/pre.yaml
+++ b/playbooks/setup-openstack-iscsi-multipath/pre.yaml
@@ -109,3 +109,108 @@
ip_node_2_iscsi0: {{ ip_node_2_iscsi0 }}
ip_node_2_iscsi1: {{ ip_node_2_iscsi1 }}
dest: "~/ansivars.yaml"
+
+
+- hosts: lab-sp-a1
+ vars_files:
+ - vars.yaml
+ tasks:
+ - set_fact:
+ sp_iscsi0_mac: "{{ hostvars['undercloud-client']['port_node_1_iscsi0_mac'] }}"
+ sp_iscsi1_mac: "{{ hostvars['undercloud-client']['port_node_1_iscsi1_mac'] }}"
+ ip_node_1_iscsi0: "{{ hostvars['undercloud-client']['ip_node_1_iscsi0'] }}/24"
+ ip_node_1_iscsi1: "{{ hostvars['undercloud-client']['ip_node_1_iscsi1'] }}/24"
+
+ - set_fact:
+ storpool_netplan: "{{ hostvars['localhost'].STORPOOL_ISCSI_NETPLAN.v }}"
+ no_log: true
+
+ - name: Provision the Netplan Template
+ no_log: true
+ become: true
+ ansible.builtin.copy:
+ content: "{{ storpool_netplan }}"
+ dest: /etc/netplan/60-storpool-iscsi.network
+
+ - name: Generate Netplan
+ become: true
+ ansible.builtin.command:
+ argv: ["netplan", "generate"]
+
+ - name: Restart Netplan
+ become: true
+ ansible.builtin.command:
+ argv: ["netplan", "apply"]
+
+ - name: Create Service to Apply Interface Configuration on Boot
+ no_log: true
+ become: true
+ ansible.builtin.copy:
+ content: "{{ hostvars['localhost'].STORPOOL_NETPLAN_SERVICE.v }}"
+ dest: /etc/systemd/system/netplan-fix.service
+
+ - name: Enable Service to Apply Interface Configuration on Boot
+ no_log: true
+ become: true
+ ansible.builtin.command:
+ argv: [ "systemctl", "enable", "netplan-fix" ]
+
+ - name: Provision StorPool Deployment Configuration
+ no_log: true
+ ansible.builtin.lineinfile:
+ path: /home/ubuntu/.ssh/authorized_keys
+ line: "{{ STORPOOL_DEPLOY_KEY_PUB['v'] }}"
+ insertafter: EOF
+
+- hosts: controller
+ vars_files:
+ - vars.yaml
+ tasks:
+ - set_fact:
+ iscsi_mac: "{{ hostvars['undercloud-client']['port_node_2_iscsi0_mac'] }}"
+ iscsi_ip: "{{ hostvars['undercloud-client']['ip_node_2_iscsi0'] }}/24"
+
+ - set_fact:
+ systemd_networkd_iscsi: "{{ hostvars['localhost'].ISCSI_NODE_SYSTEMD_NETWORKD.v }}"
+ no_log: true
+
+ - name: Provision the Netplan Template for iSCSI Network 1
+ no_log: true
+ become: true
+ ansible.builtin.copy:
+ content: "{{ systemd_networkd_iscsi }}"
+ dest: /etc/systemd/network/60-storpool-iscsi-1.network
+
+ - set_fact:
+ iscsi_mac: "{{ hostvars['undercloud-client']['port_node_2_iscsi1_mac'] }}"
+ iscsi_ip: "{{ hostvars['undercloud-client']['ip_node_2_iscsi1'] }}/24"
+
+ - set_fact:
+ systemd_networkd_iscsi: "{{ hostvars['localhost'].ISCSI_NODE_SYSTEMD_NETWORKD.v }}"
+ no_log: true
+
+ - name: Provision the Netplan Template for iSCSI Network 2
+ no_log: true
+ become: true
+ ansible.builtin.copy:
+ content: "{{ systemd_networkd_iscsi }}"
+ dest: /etc/systemd/network/61-storpool-iscsi-2.network
+
+ - name: Restart systemd-networkd to Apply the Network Configuration
+ become: true
+ ansible.builtin.command:
+ argv: [ "systemctl", "restart", "systemd-networkd" ]
+
+ - name: Set multipath.conf user_friendly_names to no
+ become: true
+ ansible.builtin.copy:
+ content: "defaults {\n user_friendly_names no\n getuid_callout \"/lib/udev/scsi_id --whitelisted --device=/dev/%n\"\n}\n"
+ dest: "/etc/multipath.conf"
+ owner: root
+ group: root
+ mode: '0644'
+
+ - name: Restart multipathd
+ become: true
+ ansible.builtin.command:
+ argv: [ "systemctl", "restart", "multipathd" ]
\ No newline at end of file