I'm pretty sure I'm doing something wrong here and am hoping some of you
with more seasoning can help me figure it out.
I have a task:
- name: Ensure /etc/hosts.deny has default ALL entry
lineinfile: >
dest="/etc/hosts.deny"
line="ALL {{':'}} ALL"
insertbefore=EOF
create=yes
state=present
tags:
- deny
When I run this on a system which doesn't have an /etc/hosts.deny, I get
this:
TASK: [compliance | Ensure /etc/hosts.deny has default ALL entry]
**************
failed: [us202] => {"failed": true, "parsed": false}
Traceback most recent call last):
File "<stdin>", line 2200, in <module>
File "<stdin>", line 395, in main
File "<stdin>", line 288, in present
File "<stdin>", line 178, in check_file_attrs
File "<stdin>", line 1199, in set_fs_attributes_if_different
File "<stdin>", line 1037, in set_mode_if_different
OSError: [Errorno 2] No such file or directory: '/etc/hosts.deny'
I would have expected ansible to create the file instead of erroring out.
If the file does exist but is empty or contains comments (and not the "ALL
: ALL" line), ansible just reports an "ok" without adding the line.
What am I doing wrong?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/69f67fcb-c472-4528-9831-fa9af9736884%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.