def main()

in LinuxCis/library/grub_crypt.py [0:0]


def main():
    '''Return a crypt-ed password for use with GRUB2'''
    module = AnsibleModule(
        argument_spec=dict(
            salt=dict(required=False, default=None),
            password=dict(
                no_log=True,
                required=False,
                default='random',
                type='str'
            ),
        )

    )
    salt = module.params['salt']
    password = module.params['password']
    if password == 'random':
        password = gen_pass()
    sha512_salt = gen_salt(salt)
    salted_pass = crypt.crypt(password, sha512_salt)
    module.exit_json(changed=False, passhash=salted_pass)