Consider the following:
- name: Change sshd_config settings
lineinfile:
path: /etc/ssh/sshd_config
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- {regexp: "^#.*ClientAliveInterval.*$", line: "ClientAliveInterval
1800"}
- {regexp: "^#.*ClientAliveCountMax.*$", line: "ClientAliveCountMax 0"}
notify:
- restart ssh
If I run this against a server multiple times, it will append the lines to
the bottom of the file (even if present). According to the docs the line
will only be applied if the regexp is found. I must be missing something.
Any ideas? If the regexp isn't found, I do want them appended to the file,
but in this case I am getting duplicate entries.
sshd_config sample:
...
#PermitUserEnvironment no
#Compression delayed
ClientAliveInterval 1800
ClientAliveCountMax 0
...
# X11Forwarding no
# AllowTcpForwarding no
# PermitTTY no
# ForceCommand cvs server
ClientAliveInterval 1800
ClientAliveCountMax 0
ClientAliveInterval 1800
ClientAliveCountMax 0
ClientAliveInterval 1800
ClientAliveCountMax 0
--
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/6fa0ec20-f82d-49f5-9364-8e2462687950%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.