From 13195c8c2292f5513a3c2546ad6093e284b59959 Mon Sep 17 00:00:00 2001 From: Nitish K Mishra Date: Sat, 30 Mar 2024 14:02:51 +0530 Subject: [PATCH] Lint: intsallp, lpar, lppp, lvm facts,lvol, mkfilt, mktcpip, mktun (#438) Signed-off-by: Nitish K Mishra --- playbooks/demo_installp.yml | 29 ++++++++--------- playbooks/demo_lpar_facts.yml | 8 ++--- playbooks/demo_lpp_facts.yml | 60 ++++++++++++++++------------------- playbooks/demo_lvm_facts.yml | 24 +++++++------- playbooks/demo_lvol.yml | 55 +++++++++++++++----------------- playbooks/demo_mkfilt.yml | 52 +++++++++++++++--------------- playbooks/demo_mktcpip.yml | 20 ++++++------ playbooks/demo_mktun.yml | 49 ++++++++++++++-------------- 8 files changed, 137 insertions(+), 160 deletions(-) diff --git a/playbooks/demo_installp.yml b/playbooks/demo_installp.yml index bc9296a4..8a90c0a8 100644 --- a/playbooks/demo_installp.yml +++ b/playbooks/demo_installp.yml @@ -1,35 +1,32 @@ --- -- name: "INSTALLP on AIX" +- name: INSTALLP on AIX hosts: "{{host_name}}" - gather_facts: no + gather_facts: false vars: host_name: all device_name: /dev/rmt0.1 - collections: - - ibm.power_aix tasks: - - name: List all software products and installable options contained on an installation cartridge tape - installp: + ibm.power_aix.installp: action: list - device: "{{device_name}}" + device: "{{ device_name }}" - name: List all customer-reported problems fixed by all software products on an installation tape - installp: + ibm.power_aix.installp: action: list_fixes - device: "{{device_name}}" + device: "{{ device_name }}" install_list: all - name: Install all filesets within the bos.net software package and expand file systems if necessary - installp: - extend_fs: yes + ibm.power_aix.installp: + extend_fs: true device: /usr/sys/inst.images install_list: bos.net - name: Reinstall and commit the NFS software product option that is already installed on the system at the same level - installp: - commit: yes - force: yes - device: "{{device_name}}" + ibm.power_aix.installp: + commit: true + force: true + device: "{{ device_name }}" install_list: bos.net.nfs.client:4.1.0.0 - name: Remove a fileset named bos.net.tcp.server - installp: + ibm.power_aix.installp: action: deinstall install_list: bos.net.tcp.server diff --git a/playbooks/demo_lpar_facts.yml b/playbooks/demo_lpar_facts.yml index b4a7c43d..8994431e 100644 --- a/playbooks/demo_lpar_facts.yml +++ b/playbooks/demo_lpar_facts.yml @@ -1,16 +1,14 @@ --- - name: "Print the LPAR related information" hosts: "{{ hosts_val }}" - gather_facts: yes + gather_facts: true vars: hosts_val: all log_file: "/tmp/ansible_lpar_debug.log" - collections: - - ibm.power_aix tasks: - name: "LPAR information" - lpar_facts: + ibm.power_aix.lpar_facts: - name: Print the LPAR related information - debug: + ansible.builtin.debug: var: ansible_facts.lpar diff --git a/playbooks/demo_lpp_facts.yml b/playbooks/demo_lpp_facts.yml index 8ea61bbd..260df674 100644 --- a/playbooks/demo_lpp_facts.yml +++ b/playbooks/demo_lpp_facts.yml @@ -1,72 +1,66 @@ --- -- name: "Print the fileset related information" +- name: Print the fileset related information hosts: "{{ hosts_val }}" - gather_facts: yes + gather_facts: true vars: hosts_val: all - log_file: "/tmp/ansible_lpp_debug.log" - collections: - - ibm.power_aix - + log_file: /tmp/ansible_lpp_debug.log tasks: - - name: "Gather the fileset facts" + - name: Gather the fileset facts lpp_facts: - name: Check whether a fileset called 'openssh.base.client' is installed - debug: + ansible.builtin.debug: msg: Fileset 'openssh.base.client' is installed when: "'openssh.base.client' in ansible_facts.filesets" - name: Check whether a fileset called 'test.base.xyz' is installed - debug: + ansible.builtin.debug: msg: Fileset 'test.base.xyz' is installed when: "'test.base.xyz' in ansible_facts.filesets" - - name: "Gather the fileset facts" - lpp_facts: + - name: Gather the fileset facts + ibm.power_aix.lpp_facts: filesets: openssh.base.client - - name: "Gather the fileset facts" - lpp_facts: + - name: Gather the fileset facts + ibm.power_aix.lpp_facts: filesets: test.base.xyz - - name: Populate fileset facts with the installation state for the most recent - level of installed filesets for all of the bos.rte filesets - lpp_facts: + - name: Populate fileset facts with the installation state for the most recent level of installed filesets for all of the bos.rte filesets + ibm.power_aix.lpp_facts: filesets: bos.rte.* - name: Print the fileset facts - debug: + ansible.builtin.debug: var: ansible_facts.filesets - - name: Populate fileset facts with the installation state for all the filesets - contained in the Server bundle - lpp_facts: + - name: Populate fileset facts with the installation state for all the filesets contained in the Server bundle + ibm.power_aix.lpp_facts: bundle: Server - name: Print the fileset facts - debug: + ansible.builtin.debug: var: ansible_facts.filesets - name: Print the filesets in a lists - set_fact: + ansible.builtin.set_fact: fileset_list: "{{ ansible_facts.filesets.keys() | list }}" - - debug: + - ansible.builtin.debug: var: fileset_list - - name: Populate fileset facts with the installation state for the most recent - level of installed filesets for all of the bos.rte filesets and also with - the requisites details - lpp_facts: - filesets: bos.rte.* - reqs: True + - name: Populate fileset facts with the installation state for the most recent level of installed filesets + for all of the bos.rte filesets and also with the requisites details + ibm.power_aix.lpp_facts: + filesets: bos.rte.* + reqs: true - name: Print the fileset facts - debug: - var: ansible_facts.filesets + ansible.builtin.debug: + var: ansible_facts.filesets - name: Populate fixes facts with the status of APAR fixes installed on the system - lpp_facts: + ibm.power_aix.lpp_facts: fix_type: apar - name: Print the fixes facts - debug: + ansible.builtin.debug: var: ansible_facts.fixes diff --git a/playbooks/demo_lvm_facts.yml b/playbooks/demo_lvm_facts.yml index b9c72381..30441025 100644 --- a/playbooks/demo_lvm_facts.yml +++ b/playbooks/demo_lvm_facts.yml @@ -1,26 +1,24 @@ --- -- name: "Print the LVM related information" +- name: Print the LVM related information hosts: "{{ hosts_val }}" - gather_facts: yes + gather_facts: true vars: hosts_val: all - log_file: "/tmp/ansible_lvmfacts_debug.log" - collections: - - ibm.power_aix + log_file: /tmp/ansible_lvmfacts_debug.log tasks: - - name: "Gather all lvm facts" - lvm_facts: - - name: "Gather VG facts" - lvm_facts: + - name: Gather all lvm facts + ibm.power_aix.lvm_facts: + - name: Gather VG facts + ibm.power_aix.lvm_facts: name: all component: vg - - name: "Gather LV facts" - lvm_facts: + - name: Gather LV facts + ibm.power_aix.lvm_facts: name: all component: lv - - name: "Update PV facts to existing LVM facts" - lvm_facts: + - name: Update PV facts to existing LVM facts + ibm.power_aix.lvm_facts: name: all component: pv lvm: "{{ ansible_facts.LVM }}" diff --git a/playbooks/demo_lvol.yml b/playbooks/demo_lvol.yml index 0eb57dd3..2b4d3611 100644 --- a/playbooks/demo_lvol.yml +++ b/playbooks/demo_lvol.yml @@ -1,57 +1,54 @@ --- -- name: "LVOL on AIX" - hosts: "{{host_name}}" - gather_facts: no +- name: LVOL on AIX + hosts: "{{ host_name }}" + gather_facts: false vars: host_name: all vg_name: rootvg lv_name: testlv - size_val: "64M" - increase_size_val: - - collections: - ibm.power_aix + size_val: 64M + increase_size_val: tasks: - name: Create a logical volume of 64M - lvol: + ibm.power_aix.lvol: state: present - vg: "{{vg_name}}" + vg: "{{ vg_name }}" lv: testrootlv - size: "{{size_val}}" + size: "{{ size_val }}" - name: Create a logical volume of 10 logical partitions with disks hdisk0 and hdisk1 - lvol: + ibm.power_aix.lvol: state: present - vg: "{{vg_name}}" + vg: "{{ vg_name }}" lv: test2lv - size: "{{size_val}}" + size: "{{ size_val }}" pv_list: hdisk0, hdisk1 - name: Create a logical volume of 32M with a minimum placement policy - lvol: + ibm.power_aix.lvol: state: present - vg: "{{vg_name}}" + vg: "{{ vg_name }}" lv: test4lv - size: "32M" + size: 32M policy: minimum - name: Create a logical volume with extra options like mirror pool - lvol: + ibm.power_aix.lvol: state: present - vg: "{{vg_name}}" - lv: "{{lv_name}}" - size: "{{size_val}}" + vg: "{{ vg_name }}" + lv: "{{ lv_name }}" + size: "{{ size_val }}" extra_opts: -m copy1=poolA -m copy2=poolB - name: Extend a logical volume by 1G - lvol: + ibm.power_aix.lvol: state: present - vg: "{{vg_name}}" - lv: "{{lv_name}}" - size: "+1G" + vg: "{{ vg_name }}" + lv: "{{ lv_name }}" + size: +1G - name: Rename a logical volume - lvol: + ibm.power_aix.lvol: state: present - vg: "{{vg_name}}" - lv: "{{lv_name}}" + vg: "{{ vg_name }}" + lv: "{{ lv_name }}" lv_new_name: renamedlv - name: Remove the logical volume - lvol: + ibm.power_aix.lvol: state: absent lv: testrootlv diff --git a/playbooks/demo_mkfilt.yml b/playbooks/demo_mkfilt.yml index 26201b76..780d989f 100644 --- a/playbooks/demo_mkfilt.yml +++ b/playbooks/demo_mkfilt.yml @@ -1,47 +1,45 @@ --- -- name: "MKFILT on AIX" +- name: MKFILT on AIX hosts: "{{host_name}}" - gather_facts: no + gather_facts: false vars: host_name: all interface_v: en0 import_directory: /root export_directory: /root - collections: - ibm.power_aix tasks: - name: Allow SSH activity through interface - mkfilt: + ibm.power_aix.mkfilt: ipv4: - log: yes + log: true default: deny rules: - - action: permit - direction: inbound - d_opr: eq - d_port: 22 - interface: "{{interface_v}}" - description: permit SSH requests from any clients - - action: permit - direction: outbound - s_opr: eq - s_port: 22 - interface: "{{interface_v}}" - description: permit SSH answers to any clients + - action: permit + direction: inbound + d_opr: eq + d_port: 22 + interface: "{{ interface_v }}" + description: permit SSH requests from any clients + - action: permit + direction: outbound + s_opr: eq + s_port: 22 + interface: "{{ interface_v }}" + description: permit SSH answers to any clients - name: Remove all user-defined and auto-generated filter rules - mkfilt: + ibm.power_aix.mkfilt: ipv4: default: permit - force: yes + force: true rules: - - action: remove - id: all + - action: remove + id: all - name: Export filter rules as is into export text files - mkfilt: + ibm.power_aix.mkfilt: action: export - directory: "{{export_directory}}" - rawexport: yes + directory: "{{ export_directory }}" + rawexport: true - name: Import Filter rules - mkfilt: + ibm.power_aix.mkfilt: action: import - directory: "{{import_directory}}" + directory: "{{ import_directory }}" diff --git a/playbooks/demo_mktcpip.yml b/playbooks/demo_mktcpip.yml index 7f5ed0c1..d6b852b5 100644 --- a/playbooks/demo_mktcpip.yml +++ b/playbooks/demo_mktcpip.yml @@ -1,21 +1,19 @@ --- -- name: "MKTCPIP on AIX" - hosts: "{{host_name}}" - gather_facts: no +- name: MKTCPIP on AIX + hosts: "{{ host_name }}" + gather_facts: false vars: host_name: all address_v: 192.9.200.4 nameserver_v: 192.9.200.1 interface_v: en0 domain_v: austin.century.com - collections: - ibm.power_aix tasks: - name: Set the required values for starting TCP/IP - mktcpip: + ibm.power_aix.mktcpip: hostname: fred.austin.century.com - address: "{{address_v}}" - interface: "{{interface_v}}" - nameserver: "{{nameserver_v}}" - domain: "{{domain_v}}" - start_daemons: yes + address: "{{ address_v }}" + interface: "{{ interface_v }}" + nameserver: "{{ nameserver_v }}" + domain: "{{ domain_v }}" + start_daemons: true diff --git a/playbooks/demo_mktun.yml b/playbooks/demo_mktun.yml index 10012d8e..2f15dc54 100644 --- a/playbooks/demo_mktun.yml +++ b/playbooks/demo_mktun.yml @@ -1,72 +1,69 @@ --- -- name: "Demo for mktun module" +- name: Demo for mktun module hosts: "{{ hosts_val }}" - gather_facts: yes + gather_facts: true vars: hosts_val: all - log_file: "/tmp/ansible_mktun_debug.log" - collections: - - ibm.power_aix - + log_file: /tmp/ansible_mktun_debug.log tasks: - name: Create and activate a manual IPv4 tunnel - mktun: + ibm.power_aix.mktun: manual: ipv4: - - src: - address: 10.10.11.72 - ah_algo: HMAC_MD5 - esp_algo: DES_CBC_8 - dst: - address: 10.10.11.98 - esp_spi: 12345 + - src: + address: 10.10.11.72 + ah_algo: HMAC_MD5 + esp_algo: DES_CBC_8 + dst: + address: 10.10.11.98 + esp_spi: 12345 - name: Export IPv4 tunnel definition for tunnel id 3 on srchost - mktun: + ibm.power_aix.mktun: manual: ipv4: - id: 3 - export: yes + export: true register: export_result - when: 'inventory_hostname == srchost' + when: inventory_hostname == srchost - name: Import IPv4 tunnel definition on dsthost - mktun: + ibm.power_aix.mktun: manual: - import_ipv4: '{{ export_result.export_ipv4 }}' - when: 'inventory_hostname == dsthost' + import_ipv4: "{{ export_result.export_ipv4 }}" + when: inventory_hostname == dsthost - name: Remove manual IPv4 tunnel with id 3 from tunnel database - mktun: + ibm.power_aix.mktun: manual: ipv4: - id: 3 state: absent - name: Try again to Remove manual IPv4 tunnel with id 3 from tunnel database - mktun: + ibm.power_aix.mktun: manual: ipv4: - id: 3 state: absent - name: Deactivate manual IPv4 tunnel with id 4 - mktun: + ibm.power_aix.mktun: manual: ipv4: - id: 4 state: defined - name: Activate manual IPv4 tunnel with id 5 - mktun: + ibm.power_aix.mktun: manual: ipv4: - id: 5 state: active - name: Gather the tunnel facts - mktun: + ibm.power_aix.mktun: - name: Print the tunnel facts - debug: + ansible.builtin.debug: var: ansible_facts.tunnels