On 26.02.2019 22:57, John Harmon wrote:
> 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
Your regexps is checking for a line starting with hash #, but you don't have a line starting with # and contain ClientAliveInterval and ClientAliveCountMax.
And when you add a line that is also without # in the start of the line.
Remove your # in regexp.
--
Kai Stian Olstad