- name: Include OS-specific variables include_vars: "{{ item }}" with_first_found: - files: - "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml" - "{{ ansible_os_family }}.yml" - name: uninstall ssmtp package: state: absent name: ssmtp become: yes - name: Install msmtp package: state: present name: "{{ msmtp_package }}" become: yes - name: Set up msmtp.conf template: src: msmtprc.j2 dest: /etc/msmtprc owner: root group: mail mode: '0640' become: yes - name: Set up aliases template: src: aliases.j2 dest: /etc/aliases owner: root group: mail mode: '0640' become: yes #- name: set right on /usr/sbin/msmtp # file: # path: /usr/sbin/msmtp # required. Path to the file being managed. # group: mail # not required. Name of the group that should own the file/directory, as would be fed to I(chown). # mode: 2711 # not required. Mode the file or directory should be. For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers. You must either add a leading zero so that Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it (like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from string into number. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results. As of version 1.8, the mode may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). # owner: root # not required. Name of the user that should own the file/directory, as would be fed to I(chown). # become: yes #sudo chown root:mail /usr/sbin/msmtp /etc/msmtp{,/{msmtp.conf,revaliases}} #sudo chmod 2711 /usr/sbin/msmtp #sudo chmod o-rwx /etc/msmtp /etc/msmtp/msmtp.conf;