Closed
Description
Description
TASK [devsec.hardening.os_hardening : Set ownership of root user home directory(s) to 0700] ************************************
fatal: [NextCloud_test_node]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: list object has no element 4\n\nThe error appears to be in '/root/.ansible/collections/ansible_collections/devsec/hardening/roles/os_hardening/tasks/user_accounts.yml': line 52, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set ownership of root user home directory(s) to 0700\n ^ here\n"}
Reproduction steps
$ ansible-galaxy collection install devsec.hardening
$ cat /etc/ansible/endurecimiento.yml
---
- name: Aplicar endurecimiento de seguridad
hosts: NextCloud_test_node
collections:
- devsec.hardening
tasks:
- name: Ejecutar endurecimiento de seguridad del SO
include_role:
name: os_hardening
- name: Ejecutar endurecimiento de seguridad del ssh
include_role:
name: ssh_hardening
Current Behavior
I obtained the error:
TASK [devsec.hardening.os_hardening : Set ownership of root user home directory(s) to 0700] ************************************
fatal: [NextCloud_test_node]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: list object has no element 4\n\nThe error appears to be in '/root/.ansible/collections/ansible_collections/devsec/hardening/roles/os_hardening/tasks/user_accounts.yml': line 52, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set ownership of root user home directory(s) to 0700\n ^ here\n"}
Expected Behavior
No fails
OS / Environment
Ubuntu-20.04
Ansible Version
$ ansible --version
ansible [core 2.13.7]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
jinja version = 3.0.3
libyaml = True
Collection Version
$ ansible-galaxy collection list devsec.hardening
# /root/.ansible/collections/ansible_collections
Collection Version
---------------- -------
devsec.hardening 8.6.0