Describe the bug
When running Ansible tool chain as standalone, task 1.11 throws error 'item' is undefined when looping through the item list variables 'admin_groups' & 'admin_users'
TASK [roles-os/1.11-accounts : 1.11 Accounts - Create specified admin groups if needed tier: {{ tier }}] ***********************************************************************************************************task path: /xxxxxx/sap-automation/deploy/ansible/roles-os/1.11-accounts/tasks/main.yml:27
The conditional check 'item.enabled | bool' failed. The error was: error while evaluating conditional (item.enabled | bool): 'item' is undefined
The error appears to be in '/xxxxxx/sap-automation/deploy/ansible/roles-os/1.11-accounts/tasks/main.yml': line 27, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
by the following user actions
Should be written as:
with_items:
- "{{ foo }}"
fatal: [hana-01]: FAILED! => {"msg": "[{'name': 'example', 'gid': '2000', 'state': 'present', 'tier': 'example', 'enabled': True, 'node_tier': 'none'}, {'name': 'sapsys', 'gid': '{{ sapsys_gid }}', 'state': 'present', 'tier': 'os', 'enabled': True, 'node_tier': 'all'}, {'name': 'sapinst', 'gid': '{{ sapinst_gid }}', 'state': 'present', 'tier': 'os', 'enabled': True, 'node_tier': 'all'}, {'name': 'dba', 'gid': '{{ dba_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'oper', 'gid': '{{ oper_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'asmoper', 'gid': '{{ asmoper_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'asmadmin', 'gid': '{{ asmadmin_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'asmdba', 'gid': '{{ asmdba_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'oinstall', 'gid': '{{ oinstall_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'dba', 'gid': '{{ dba_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'oper', 'gid': '{{ oper_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'asmoper', 'gid': '{{ asmoper_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'asmadmin', 'gid': '{{ asmadmin_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'asmdba', 'gid': '{{ asmdba_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'oinstall', 'gid': '{{ oinstall_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}]: 'dba_gid' is undefined"}
The conditional check 'item.enabled | bool' failed. The error was: error while evaluating conditional (item.enabled | bool): 'item' is undefined
The error appears to be in '/xxxxxx/sap-automation/deploy/ansible/roles-os/1.11-accounts/tasks/main.yml': line 27, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
by the following user actions
Should be written as:
with_items:
- "{{ foo }}"
fatal: [app-01]: FAILED! => {"msg": "[{'name': 'example', 'gid': '2000', 'state': 'present', 'tier': 'example', 'enabled': True, 'node_tier': 'none'}, {'name': 'sapsys', 'gid': '{{ sapsys_gid }}', 'state': 'present', 'tier': 'os', 'enabled': True, 'node_tier': 'all'}, {'name': 'sapinst', 'gid': '{{ sapinst_gid }}', 'state': 'present', 'tier': 'os', 'enabled': True, 'node_tier': 'all'}, {'name': 'dba', 'gid': '{{ dba_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'oper', 'gid': '{{ oper_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'asmoper', 'gid': '{{ asmoper_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'asmadmin', 'gid': '{{ asmadmin_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'asmdba', 'gid': '{{ asmdba_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'oinstall', 'gid': '{{ oinstall_gid }}', 'state': 'present', 'tier': 'ora', 'enabled': True, 'node_tier': 'oracle'}, {'name': 'dba', 'gid': '{{ dba_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'oper', 'gid': '{{ oper_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'asmoper', 'gid': '{{ asmoper_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'asmadmin', 'gid': '{{ asmadmin_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'asmdba', 'gid': '{{ asmdba_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}, {'name': 'oinstall', 'gid': '{{ oinstall_gid }}', 'state': 'present', 'tier': 'oraasm', 'enabled': True, 'node_tier': 'oracle-asm'}]: 'dba_gid' is undefined"}
To reproduce
Steps to reproduce the behavior:
Execute playbook "playbook_01_00_01_os_base_config.yaml"
Expected behavior
Playbook execution should complete without errors.
Additional context
Code is running on Ubuntu 20.04 with ansible 2.11.5
Tested on Main and private-preview branch.
admin-accounts.yml is successfully loaded in /xxxxxx/sap-automation/deploy/ansible/roles-os/1.11-accounts/tasks/main.yml': line 22
ansible [core 2.11.5]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
jinja version = 2.10.1
libyaml = True