--- - name: Install required packages apt: state: present name: - curl - gawk - name: Create directories for notify script file: state: directory path: "{{ item }}" owner: root group: root mode: u=rwx,g=rx,o= loop: - "{{ notify_directory }}" - "{{ notify_cache_directory }}" - 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"