From 884f0125c1ae67674b25317e6957d84ce50212fc Mon Sep 17 00:00:00 2001 From: Shreyansh Chamola Date: Wed, 17 Jul 2024 08:25:05 +0530 Subject: [PATCH] Fixed linting issues (#556) * Fixed linting issues Signed-off-by: schamola * linting issue Signed-off-by: schamola --------- Signed-off-by: schamola --- playbooks/demo_chsec.yml | 12 +++---- playbooks/demo_flrtvc_local_patch_server.yml | 30 +++++++++--------- playbooks/demo_hdcrypt_pks.yml | 6 ++-- playbooks/demo_install_all_updates.yml | 4 +-- playbooks/demo_lku.yml | 27 ++++++++-------- playbooks/demo_mpio.yml | 2 +- playbooks/demo_password_rules_policies.yml | 21 ++++++------- playbooks/demo_shell_flrtvc_wget_ifix.yml | 33 +++++++++++--------- tests/sanity/ignore-2.14.txt | 3 -- tests/sanity/ignore-2.15.txt | 3 -- 10 files changed, 69 insertions(+), 72 deletions(-) delete mode 100644 tests/sanity/ignore-2.14.txt delete mode 100644 tests/sanity/ignore-2.15.txt diff --git a/playbooks/demo_chsec.yml b/playbooks/demo_chsec.yml index 17c2ac12..0eb6b7c2 100644 --- a/playbooks/demo_chsec.yml +++ b/playbooks/demo_chsec.yml @@ -1,10 +1,10 @@ --- - name: CHSEC on AIX hosts: "{{host_name}}" - gather_facts: False + gather_facts: false vars: host_name: all - tasks: + tasks: - name: Add registry as files for a user ibm.power_aix.chsec: file: /etc/security/user @@ -31,9 +31,9 @@ path: /etc/security/user stanza: "{{ item }}" attrs: - account_locked: True - login: False - rlogin: False + account_locked: true + login: false + rlogin: false state: present loop: - "adm" @@ -55,7 +55,7 @@ file: /etc/security/user stanza: joe attrs: - su: False + su: false state: present - name: Set password rules for a user ibm.power_aix.chsec: diff --git a/playbooks/demo_flrtvc_local_patch_server.yml b/playbooks/demo_flrtvc_local_patch_server.yml index 139bc690..2a9e207f 100644 --- a/playbooks/demo_flrtvc_local_patch_server.yml +++ b/playbooks/demo_flrtvc_local_patch_server.yml @@ -1,12 +1,12 @@ --- -#ptsiamis@gmail.com -#Demo playbook -#Create a local nginx with the patches -#Download patches with playbook: -#demo_shell_flrtvc_wget_ifix.yml +# ptsiamis@gmail.com +# Demo playbook +# Create a local nginx with the patches +# Download patches with playbook: +# demo_shell_flrtvc_wget_ifix.yml - name: "Demo install ifix from flrtvc from local patch server" hosts: all - gather_facts: no + gather_facts: false vars: localpatchserver: "192.168.1.1" localpatchpath: "ifix" @@ -15,20 +15,20 @@ flrtvczip: "{{protocol}}://{{localpatchserver}}/{{localpatchpath}}/FLRTVC-latest.zip" apar_csv_url: "{{protocol}}://{{localpatchserver}}/{{localpatchpath}}/apar.csv" debug: false - collections: - - ibm.power_aix tasks: - - name: Download apar.csv to {{ apar_csv }} from {{ apar_csv_url }} - ansible.builtin.shell: - cmd: "wget -q --no-check-certificate {{ apar_csv_url }} -O {{ apar_csv }}" + - name: Download apar.csv to /tmp/apar.csv from {{ apar_csv_url }} + ansible.builtin.get_url: + url: "{{ apar_csv_url }}" + dest: "{{ apar_csv }}" + validate_certs: false - - name: install all security interim fixes + - name: Install all security interim fixes ibm.power_aix.flrtvc: apar: "sec" verbose: true protocol: "{{ protocol }}" - force: no - clean: no + force: false + clean: false flrtvczip: "{{ flrtvczip }}" localpatchserver: "{{ localpatchserver }}" localpatchpath: "{{ localpatchpath }}" @@ -39,7 +39,7 @@ https_proxy: "" PATH: "/usr/bin:/usr/sbin:/usr/local/bin:/opt/freeware/bin" - - name: debug reg_install + - name: Debug reg_install ansible.builtin.debug: var: reg_install when: debug diff --git a/playbooks/demo_hdcrypt_pks.yml b/playbooks/demo_hdcrypt_pks.yml index 03154168..e585941a 100644 --- a/playbooks/demo_hdcrypt_pks.yml +++ b/playbooks/demo_hdcrypt_pks.yml @@ -28,7 +28,7 @@ device: "{{ lv_val }}" location: "{{ loc }}" passphrase: "{{ pass_val }}" - no_log: True + no_log: true - name: "Import PKS key" ibm.power_aix.hdcrypt_pks: @@ -36,9 +36,9 @@ device: "{{ lv_val }}" location: "{{ loc }}" passphrase: "{{ pass_val }}" - no_log: True + no_log: true - name: "Clean invalid PKS key" ibm.power_aix.hdcrypt_pks: action: clean - pks_label: "{{ key_label }}" \ No newline at end of file + pks_label: "{{ key_label }}" diff --git a/playbooks/demo_install_all_updates.yml b/playbooks/demo_install_all_updates.yml index 122df03d..92c8c450 100644 --- a/playbooks/demo_install_all_updates.yml +++ b/playbooks/demo_install_all_updates.yml @@ -16,7 +16,7 @@ device: "{{ device_val }}" update_rpm: true - - name: install the latest level of install utilities on device /dev/cd0 (bos.rte.install update) + - name: Install the latest level of install utilities on device /dev/cd0 (bos.rte.install update) ibm.power_aix.install_all_updates: device: "{{ device_val }}" - utilities_only: true \ No newline at end of file + utilities_only: true diff --git a/playbooks/demo_lku.yml b/playbooks/demo_lku.yml index e7f61767..40bb633e 100644 --- a/playbooks/demo_lku.yml +++ b/playbooks/demo_lku.yml @@ -4,33 +4,34 @@ gather_facts: false vars: host_name: all - PVC_name: powervchostname - PVC_password: passw0rd123 - PVC_user: powervcuser + pvc_name: powervchostname + pvc_password: passw0rd123 + pvc_user: powervcuser directory: /tmp filesets_fixes: bos.mp64 bos.rte.libc IZ12345.140806.epkg.Z tasks: - name: To install the updates to two filesets and to install an interim fix ibm.power_aix.lku: - PVC_name: "{{ PVC_name }}" - PVC_password: "{{ PVC_password }}" - PVC_user: "{{ PVC_user }}" + PVC_name: "{{ pvc_name }}" + PVC_password: "{{ pvc_password }}" + PVC_user: "{{ pvc_user }}" directory: "{{ directory }}" filesets_fixes: "{{ filesets_fixes }}" - name: To install all the updates and interim fixes that are available in the /tmp directory ibm.power_aix.lku: - PVC_name: "{{ PVC_name }}" - PVC_password: "{{ PVC_password }}" - PVC_user: "{{ PVC_user }}" + PVC_name: "{{ pvc_name }}" + PVC_password: "{{ pvc_password }}" + PVC_user: "{{ pvc_user }}" directory: "{{ directory }}" filesets_fixes: all - name: To install all the updates, but not interim fixes, that are located in the /tmp directory ibm.power_aix.lku: - PVC_name: "{{ PVC_name }}" - PVC_password: "{{ PVC_password }}" - PVC_user: "{{ PVC_user }}" + PVC_name: "{{ pvc_name }}" + PVC_password: "{{ pvc_password }}" + PVC_user: "{{ pvc_user }}" directory: "{{ directory }}" - filesets_fixes: update_all \ No newline at end of file + filesets_fixes: update_all + \ No newline at end of file diff --git a/playbooks/demo_mpio.yml b/playbooks/demo_mpio.yml index 20953083..94da0822 100644 --- a/playbooks/demo_mpio.yml +++ b/playbooks/demo_mpio.yml @@ -22,4 +22,4 @@ - name: Gather mpio information when device and parent is provided ibm.power_aix.mpio: device: hdisk1 - parent: vscsi0 \ No newline at end of file + parent: vscsi0 diff --git a/playbooks/demo_password_rules_policies.yml b/playbooks/demo_password_rules_policies.yml index f98250df..6ead347c 100644 --- a/playbooks/demo_password_rules_policies.yml +++ b/playbooks/demo_password_rules_policies.yml @@ -11,19 +11,19 @@ stanza: "{{ stanza_val }}" registry: files state: present - ignore_errors: true + - name: Change login times for user ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" logintimes: :0800-1700 state: present - ignore_errors: true + - name: Remove registry attribute from stanza ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" registry: files state: absent - ignore_errors: true + - name: Lock System User Accounts ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" @@ -31,13 +31,13 @@ login: "false" rlogin: "false" state: present - ignore_errors: true + - name: Allow other users to switch to this user using su command ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" su: true state: present - ignore_errors: true + - name: Set password rules for a user ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" @@ -46,20 +46,19 @@ maxrepeats: 4 minlen: 8 state: present - ignore_errors: true + - name: Make the user admin ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" admin: true - ignore_errors: true + - name: Remove admin rights from the user ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" admin: false - ignore_errors: true + - name: Set core compress and core path to On ibm.power_aix.password_rules_policies: stanza: "{{ stanza_val }}" - core_compress: on - core_path: on - ignore_errors: true + core_compress: "on" + core_path: "on" diff --git a/playbooks/demo_shell_flrtvc_wget_ifix.yml b/playbooks/demo_shell_flrtvc_wget_ifix.yml index 4ac1a05a..1bff0a7c 100644 --- a/playbooks/demo_shell_flrtvc_wget_ifix.yml +++ b/playbooks/demo_shell_flrtvc_wget_ifix.yml @@ -7,7 +7,7 @@ # Or create your own nginx server with a similar setup - name: "AIX sync all ifixes on webserver" hosts: aap-server - gather_facts: no + gather_facts: false vars: ifix_path: "/var/lib/awx/ifix/" ifix_url: "https://aix.software.ibm.com/aix/ifixes/security/" @@ -21,51 +21,54 @@ sync_apar: true sync_flrtvc: true tasks: - - name: "Create ifix_path {{ ifix_path }} if not exists" + - name: "Create ifix_path /var/lib/awx/ifix/ if not exists" ansible.builtin.file: path: "{{ ifix_path }}" state: directory mode: '0755' - - name: "Synchronizing ifix to {{ ifix_path }} from {{ ifix_url }} " - ansible.builtin.shell: + - name: "Synchronizing ifix to /var/lib/awx/ifix/ from {{ ifix_url }} " + ansible.builtin.command: cmd: "{{ proxy }} wget -q -nc -r -np -nd --no-check-certificate -l 1 -A .tar,.asc,.sig {{ ifix_url }} " chdir: "{{ ifix_path }}" + changed_when: true register: ifixd when: sync_ifix - - name: print ifixd + - name: Print ifixd ansible.builtin.debug: var: ifixd - when: + when: - sync_ifix - debug - - name: "Synchronizing {{ ifix_path }}/{{ apar_csv_filename }} from {{ apr_csv_url }}" - ansible.builtin.shell: + - name: "Synchronizing /var/lib/awx/ifix/apar.csv from {{ apr_csv_url }}" + ansible.builtin.command: cmd: "{{ proxy }} wget -k {{ apar_csv_url }} -O {{ apar_csv_filename }}" chdir: "{{ ifix_path }}" + changed_when: true register: apard when: sync_apar - - name: print apard + - name: Print apard ansible.builtin.debug: var: apard - when: + when: - sync_apar - debug - - name: "Synchronizing {{ ifix_path }}/{{ flrtvc_filename }} from {{ flrtvc_url }}" - ansible.builtin.shell: + - name: "Synchronizing /var/lib/awx/ifix/FLRTVC-latest.zip from {{ flrtvc_url }}" + ansible.builtin.command: cmd: "{{ proxy }} wget -k {{ flrtvc_url }} -O {{ flrtvc_filename }}" chdir: "{{ ifix_path }}" + changed_when: true register: flrtvcd when: sync_flrtvc - - name: print flrtvcd + - name: Print flrtvcd ansible.builtin.debug: var: flrtvcd - when: + when: - sync_flrtvc - debug @@ -73,4 +76,4 @@ ansible.builtin.file: path: "{{ ifix_path }}" mode: "u=rwX,g=rwX,o=rX" - recurse: yes + recurse: true diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt deleted file mode 100644 index 55e2cfeb..00000000 --- a/tests/sanity/ignore-2.14.txt +++ /dev/null @@ -1,3 +0,0 @@ -- roles/power_aix_bootstrap/files/dnf_installer.sh shellcheck!skip -- roles/power_aix_bootstrap/files/dnf_installer.sh shebang!skip -- roles/power_aix_vioshc/files/vioshc.py shebang!skip \ No newline at end of file diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt deleted file mode 100644 index 55e2cfeb..00000000 --- a/tests/sanity/ignore-2.15.txt +++ /dev/null @@ -1,3 +0,0 @@ -- roles/power_aix_bootstrap/files/dnf_installer.sh shellcheck!skip -- roles/power_aix_bootstrap/files/dnf_installer.sh shebang!skip -- roles/power_aix_vioshc/files/vioshc.py shebang!skip \ No newline at end of file