ansible-lockdown / Windows-2019-CIS

CIS Baseline Ansible Role for Windows 2019
MIT License
130 stars 70 forks source link

ansible_windows_domain_role' is undefined #64

Closed dimi4ik closed 1 year ago

dimi4ik commented 1 year ago

Describe the Issue

When I run the role, I receive the following message:

`TASK [Windows-2019-CIS : Include the preliminary tasks] *** included: /home/azureuser/github/projekt_AnsibleLernen/azurelab/roles/Windows-2019-CIS/tasks/prelim.yml for apc000060002

TASK [Windows-2019-CIS : Set fact is system is standalone] **** fatal: [apc000060002]: FAILED! => msg: |- The conditional check 'ansible_windows_domain_role == 'Stand-alone server'' failed. The error was: error while evaluating conditional (ansible_windows_domain_role == 'Stand-alone server'): 'ansible_windows_domain_role' is undefined

The error appears to be in '/home/azureuser/github/projekt_AnsibleLernen/azurelab/roles/Windows-2019-CIS/tasks/prelim.yml': line 5, column 9, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  block:
      - name: Set fact is system is standalone
        ^ here`

The offending line appears to be:

  block:
      - name: Set fact is system is standalone
        ^ here`

Expected Behavior The task should process correctly for a domain joined machine

Actual Behavior A clear and concise description of what's happening.

Control(s) Affected What controls are being affected by the issue

Environment (please complete the following information):

Additional Notes am I doing something wrong ? thanks for the ti

Possible Solution Enter a suggested fix here

dimi4ik commented 1 year ago

can be fixed, the playbook must contain:

gather_facts: true

uk-bolly commented 1 year ago

hi @dimi4ik

Thank you for the feedback, i believe gather_facts: true is the default value. So should be run unless explicitly turned to false or defaults overridden in the loaded ansible.cfg

I will however leave this issue open to ensure we add that to the playbook, in the next release.

Thank you again for the feedback

uk-bolly

MrSteve81 commented 1 year ago

Will be added to the upcoming release in the playbook. I have assigned this to myself to add in my next release.

MrSteve81 commented 1 year ago

Complete and merged to devel.