Skip to content

Undefined variable when rendering GOSS template #294

@heni-amiri

Description

@heni-amiri

Have you checked ReadtheDocs?: Yes

Describe the Issue
In Ansible Lockdown, while running an audit, the role fails during the pre remediation audit phase and returns an error when rendering GOSS variables, apparently because it tries to lookup a variable that is not defined (grub_user_pass)

TASK [ansible-lockdown.ubuntu22_cis : Pre Audit Setup | Copy ansible default vars values to test audit] *************************************************************
task path: /Users/user/.ansible/roles/ansible-lockdown.ubuntu22_cis/tasks/pre_remediation_audit.yml:63
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.errors.AnsibleUndefinedVariable: 'grub_user_pass' is undefined
fatal: [hostname]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: 'grub_user_pass' is undefined"}

Expected Behavior
Ansible Lockdown should be able to correctly render GOSS template using Ansible variables and finish running the audit phase.

Actual Behavior
Ansible Lockdown fails with AnsibleUndefinedVariable error when copying Ansible variables to the GOSS template.
Tested with Ansible Lockdown v2.0.0 for Ubuntu 22.04.

Possible Solution
grub_user_pass should be changed to ubtu22cis_bootloader_password_hash in GOSS template.

ubtu22cis_bootloader_password_hash: {{ grub_user_pass }} # pragma: allowlist secret

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions