--- - hosts: centos8 become: true vars: config_file: /etc/postfix/main.cf postfix_myhostname: "myhostname = repo.dmz.nausch.org" postfix_mydomain : "mydomain = nausch.org" postfix_myorigin : "myorigin = $mydomain" postfix_relayhost : "relayhost = [10.0.0.87]:10025" tasks: - name: MTA - Postfix Deamon installieren dnf: # https://docs.ansible.com/ansible/latest/modules/dnf_module.html name: postfix state: latest - name: Prüfen, ob bereits eine Sicherungskopie der Postfix-Konfigurationsdatei /etc/postfix/main.cf erstellt wurde. stat: # https://docs.ansible.com/ansible/latest/modules/stat_module.html path: /etc/postfix/main.cf.orig register: stat_result - name: Wenn noch keine Sicherungskopie vorhanden ist von der Datei /etc/postfix/main.cf dann /etc/postfix/main.cf.orig erstellen. copy: # https://docs.ansible.com/ansible/latest/modules/copy_module.html remote_src: yes src: /etc/postfix/main.cf dest: /etc/postfix/main.cf.orig when: stat_result.stat.exists == False - name: Postfix Konfigurationsdatei main.cf kopieren template: # https://docs.ansible.com/ansible/latest/modules/template_module.html src: library/postfix_main_cf.j2 dest: "{{ config_file }}" - name: Sicherstellen, dass der MTA Postfix auch gestartet ist uns beim Booten gestartet wird service: #https://docs.ansible.com/ansible/latest/modules/service_module.html name: postfix state: started enabled: yes ...