HDCrypt Conv Module Overview
Overview
HDCrypt Conv is a module used to convert logical or physical volumes into encrypted ones and vice versa. It supports operations such as encrypting and decrypting logical volumes, physical volumes, and volume groups. The module requires specifying the action to perform (encrypt or decrypt) and the devices to be targeted. A password is required for both encryption and decryption processes, which must also be encrypted.
Usage of HDCrypt Conv
The hdcrypt_conv
encryption/decryption
This example demonstrates how to convert a logical volume (LV) named testlv
encrypt
- name: "convert LV (testlv) to encrypted LV"
ibm.power_aix.hdcrypt_conv:
action: encrypt
device:
lv: testlv
password: abc
Main Functions
There are several main functions in this module. Some of them are encrypt_lv
decrypt_lv
encrypt_pv
decrypt_pv
encrypt_lv
decrypt_lv
encrypt_lv
encrypt_lv
The encrypt_lv
The encrypt_lv
def encrypt_lv(module, name):
"""
Encrypts the Logical Volume it is passed
arguments:
module: Ansible module argument spec.
name: Name of the logical volume to encrypt
note:
If the volume group that the logical volume belongs to is not encryption enabled, it is first encryption enabled.
return:
None
"""
password = module.params['password']
vg_name = get_vg_name(module, name)
# Enable Encryption if not already enabled on the VG
vg_encrypt_enabled(module, vg_name)
if crypto_status == "uninitialized":
if not check_password_strength(password):
cmd = expectPrompts['authinit_weak_pwd'] % (name, password, password)
else:
decrypt_lv
decrypt_lv
The decrypt_lv
The decrypt_lv
def decrypt_lv(module, name):
"""
Decrypts the Logical Volume it is passed
arguments:
module: Ansible module argument spec.
name: Name of the logical volume to decrypt.
return:
None
"""
global convert_failed
password = module.params['password']
cmd = expectPrompts['unlock'] % (name, password)
rc, stdout, stderr = module.run_command(cmd)
result['stdout'] = stdout
result['stderr'] = stderr
result['cmd'] = cmd
if "3020-0125" in stdout:
result['msg'] += f"Password to decrypt {name} was incorrect.\n"
convert_failed = True
return
encrypt_pv
encrypt_pv
The encrypt_pv
decrypt_pv
decrypt_pv
The decrypt_pv
The decrypt_pv
def decrypt_pv(module, name):
'''
Decrypts the physical volume that is passed.
arguments:
module (dict): Ansible module argument spec.
name (str) : Name of the PV that needs to be decrypted.
returns:
None
'''
password = module.params['password']
cmd = expectPrompts['unlock'] % (name, password)
rc, stdout, stderr = module.run_command(cmd)
result['stdout'] = stdout
result['stderr'] = stderr
result['cmd'] = cmd
result['rc'] = rc
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human