--- - name: install denyhosts on debian <=7 and ubuntu <= 12.04 apt: pkg={{ item }} state=installed when: is_ubuntu_less_than_trusty with_items: - denyhosts when: is_not_trusty tags: - denyhosts - name: ensure CM can access the VMs action: | lineinfile name=/etc/hosts.allow regexp="sshd: 146.48.123.18$" line="sshd: 146.48.123.18" when: is_not_trusty tags: - denyhosts - name: ensure Monitoring can connect via ssh action: | lineinfile name=/etc/hosts.allow regexp="sshd: 146.48.123.23$" line="sshd: 146.48.123.23" when: is_not_trusty tags: - denyhosts - monitoring - name: Set the treshold for root on the denyhosts config file lineinfile: | name=/etc/denyhosts.conf regexp="^DENY_THRESHOLD_ROOT = " line="DENY_THRESHOLD_ROOT = 5" when: is_not_trusty tags: - denyhosts notify: - Restart denyhosts