--- - name: Install required packages apt: state: present name: - curl - gawk - name: Create directory for notify script file: state: directory path: "{{ notify_script | dirname }}" owner: root group: root mode: u=rwx,g=rx,o= - name: Install notify script template: src: notify.sh dest: "{{ notify_script }}" owner: root group: root mode: u=rwx,g=rx,o= validate: "{{ global_validate_shell_script }}" - name: Configure pam for ssh notify lineinfile: state: present path: "{{ global_pamd }}/sshd" regexp: "# Ansible: ssh_tg_notify$" line: "session optional pam_exec.so {{ notify_script }} # Ansible: ssh_tg_notify"