Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LKU, tunables, linting issues, ansible-version update #595

Merged
merged 6 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The nodes listed below require these specific versions of software:
Control node
------------

* `Ansible version`_: 2.15 or later
* `Ansible version`_: 2.16 or later
* `Python`_: 3.9 or later
* `OpenSSH`_

Expand Down
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
requires_ansible: '>=2.15.0'
requires_ansible: '>=2.16.0'
15 changes: 15 additions & 0 deletions playbooks/demo_aix_lku_role.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Live Kernel update operation on AIX
hosts: all
gather_facts: false
user: root
tasks:
# CHECK for Yum on inventory host
- ansible.builtin.import_role:
name: live_kernel_update
vars:
live_kernel_update_hmc_name: test1.hmc.hostname
live_kernel_update_hmc_password: password123
live_kernel_update_directory: /tmp/source
live_kernel_update_file_name: IZ12345.140806.epkg.Z
live_kernel_update_preview_mode: false
1 change: 1 addition & 0 deletions playbooks/demo_flrtvc_local_patch_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
tasks:
- name: Download apar.csv to /tmp/apar.csv from {{ apar_csv_url }}
ansible.builtin.get_url:
mode: "0644"
url: "{{ apar_csv_url }}"
dest: "{{ apar_csv }}"
validate_certs: false
Expand Down
4 changes: 2 additions & 2 deletions playbooks/demo_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
load_module: LDAP
tasks:

- name: Create a group #create a group in local
- name: Create a group # create a group in local
ibm.power_aix.group:
state: present
load_module: files
name: "{{ group_name }}"
- name: Create a group #create a group in LDAP even its present in local
- name: Create a group # create a group in LDAP even its present in local
ibm.power_aix.group:
state: present
load_module: LDAP
Expand Down
1 change: 0 additions & 1 deletion playbooks/demo_lku.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@
PVC_user: "{{ pvc_user }}"
directory: "{{ directory }}"
filesets_fixes: update_all

2 changes: 1 addition & 1 deletion playbooks/demo_password_rules_policies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
vars:
host_name: all
stanza_val: testusr
tasks:
tasks:
- name: Set registry as files
ibm.power_aix.password_rules_policies:
stanza: "{{ stanza_val }}"
Expand Down
18 changes: 9 additions & 9 deletions playbooks/demo_route.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
destination: "192.168.1.23"
gateway: "192.168.1.1"
family: "-inet"
- name: delete a default route
- name: Delete a default route
ibm.power_aix.route:
action: delete
destination: "192.168.1.23"
Expand All @@ -29,7 +29,7 @@
gateway: "192.168.1.1"
numeric: true
flags: "net"
- name: delete a route with numeric mode
- name: Delete a route with numeric mode
ibm.power_aix.route:
action: delete
destination: "192.168.4.1"
Expand All @@ -44,7 +44,7 @@
numeric: true
prefixlen: 24
flags: "net"
- name: delete a route with numeric mode
- name: Delete a route with numeric mode
ibm.power_aix.route:
action: delete
destination: "192.168.4.1"
Expand All @@ -60,7 +60,7 @@
numeric: true
prefixlen: 24
flags: "net"
- name: delete a route with numeric mode
- name: Delete a route with numeric mode
ibm.power_aix.route:
action: delete
destination: "192.168.4.1"
Expand All @@ -75,7 +75,7 @@
gateway: "192.168.2.1"
ioctl_preference: true
flags: "net"
- name: delete a route with ioctl preference
- name: Delete a route with ioctl preference
ibm.power_aix.route:
action: delete
destination: "192.168.3.0"
Expand All @@ -89,7 +89,7 @@
gateway: "192.168.3.1"
verbose: true
flags: "host"
- name: delete a route with verbose mode
- name: Delete a route with verbose mode
ibm.power_aix.route:
action: delete
destination: "192.168.4.0"
Expand All @@ -103,7 +103,7 @@
gateway: "192.168.3.2"
verbose: true
flags: "host"
- name: delete a route with verbose mode
- name: Delete a route with verbose mode
ibm.power_aix.route:
action: delete
destination: "192.168.4.0"
Expand Down Expand Up @@ -190,7 +190,7 @@
weight: "6"
policy: "4"
flags: "host"
- name: delete route attributes
- name: Delete route attributes
ibm.power_aix.route:
action: delete
destination: "192.158.4.2"
Expand Down Expand Up @@ -229,7 +229,7 @@
weight: "4"
policy: "4"
flags: "net"
- name: delete route attributes
- name: Delete route attributes
ibm.power_aix.route:
action: delete
destination: "192.158.4.2"
Expand Down
21 changes: 8 additions & 13 deletions playbooks/demo_snap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
ibm.power_aix.snap:
live_kernel: false
all_info: true
- name: collects dump
- name: Collects dump
ibm.power_aix.snap:
live_kernel: false
compress: false
Expand All @@ -32,7 +32,7 @@
compress: true
hacmp: false
reset: false
- name: hacmp Data collection
- name: HACMP Data collection
ibm.power_aix.snap:
live_kernel: false
compress: false
Expand All @@ -42,7 +42,7 @@
live_kernel: false
compress: false
file_system_info: true
- name: live kernal data
- name: Live kernal data
ibm.power_aix.snap:
live_kernel: true
compress: false
Expand All @@ -52,34 +52,29 @@
collects_dump: true
compress: false
file_system_info: false
- name: installation software data
- name: Installation software data
ibm.power_aix.snap:
installation_info: true
compress: false
file_system_info: false
- name: kernel related info
- name: Kernel related info
ibm.power_aix.snap:
kernel_info: true
compress: false
file_system_info: false
- name: security info data
- name: Security info data
ibm.power_aix.snap:
security_info: true
general_info: true
compress: false
file_system_info: false
- name: workload manager info
- name: Workload manager info
ibm.power_aix.snap:
workload_manager_info: true
compress: false
file_system_info: false
- name: hardware info data
- name: Hardware info data
ibm.power_aix.snap:
hardware_info: true
compress: false
file_system_info: false





42 changes: 21 additions & 21 deletions plugins/modules/hdcrypt_pks.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,35 +72,35 @@

EXAMPLES = r'''
- name: Add PKS to filesystem
ibm.power_aix.hdcrypt_pks:
action: addpks
device: testlv1
method_name: initpks
ibm.power_aix.hdcrypt_pks:
action: addpks
device: testlv1
method_name: initpks

- name: Display PKS keys status
ibm.power_aix.hdcrypt_pks:
action: show
ibm.power_aix.hdcrypt_pks:
action: show

- name: Export PKS key to a file
ibm.power_aix.hdcrypt_pks:
action: export
device: testlv1
location: /tmp/file123
passphrase: abc1234
no_log: True
ibm.power_aix.hdcrypt_pks:
action: export
device: testlv1
location: /tmp/file123
passphrase: abc1234
no_log: true

- name: Import PKS key
ibm.power_aix.hdcrypt_pks:
action: import
device: testlv1
location: /tmp/file123
passphrase: abc1234
no_log: True
ibm.power_aix.hdcrypt_pks:
action: import
device: testlv1
location: /tmp/file123
passphrase: abc1234
no_log: true

- name: Clean invalid PKS key
ibm.power_aix.hdcrypt_pks:
action: clean
pks_label: 00fb293100004c000000018deea122dc.3
ibm.power_aix.hdcrypt_pks:
action: clean
pks_label: 00fb293100004c000000018deea122dc.3
'''

RETURN = r'''
Expand Down
33 changes: 33 additions & 0 deletions plugins/modules/tunables.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,10 @@ def reset(module):
if bosboot_tunables or change_type == 'reboot':
cmd += '-r '

live_update = getOSlevel(module)
if live_update and component in ['vmo', 'no']:
cmd += '-K '

# -p when used in combination with -o, -d or -D, makes changes apply to both current and
# reboot values, that is, turns on the updating of the /etc/tunables/nextboot file in addition
# to the updating of the current value.
Expand Down Expand Up @@ -531,6 +535,31 @@ def reset(module):
results['msg'] += std_out


def getOSlevel(module):
'''
Checks if target node is AIX v7.3

arguments:
module (dict): The Ansible module
note:
Exits with fail_json in case of error
return:
True in case AIX is version 7.3
'''

cmd = 'oslevel -s'
rc, stdout, stderr = module.run_command(cmd)

if rc != 0:
oslevel = stdout.split("-")
if oslevel[0] == "7300":
return True
else:
return False
else:
module.fail_json(msg=stderr)


def modify(module):
'''
Handles the modify action
Expand Down Expand Up @@ -604,6 +633,10 @@ def modify(module):
if not bosboot_tunables and change_type == 'reboot':
cmd += '-r '

live_update = getOSlevel(module)
if live_update and component in ['vmo', 'no']:
cmd += '-K '

# include the tunables to be modified and their new values in command
for tunable, value in tunable_params_with_value.items():
parameters += '-o ' + tunable + '=' + str(value) + ' '
Expand Down
Loading
Loading