Why doesn’t the following work? Syntax issue? or bug?
`
- name: Backup home dir and nagios rights
shell: “cd {{ dirpath }}; getfacl -R {{ dir }} > {{ file }}.{{ ansible_date_time.date }}”
with_items: - { dirpath: “/home/”, dir: “*”, file: “home_rights.txt” }
- { dirpath: “/tmp”, dir: “*”, file: “tmp_rights.txt” }
- { dirpath: “/usr/local/”, dir: “nagios”, file: “nagios_rights.txt” }
- { dirpath: “/var/spool/mail/”, dir: “nagios”, file: “nagios_mail_rights.txt” }
delegate_to: “{{ ansible_hostname }}”
`
Result:
`
fatal: [ansible-oel6]: FAILED! => {“msg”: “The task includes an option with an undefined variable. The error was: ‘dirpath’ is undefined\n\nThe error appears to have been in ‘/etc/ansible/playbooks/one-offs/clean_up_users.yml’: line 19, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Backup home dir and nagios rights\n ^ here\n”}
`