--- # tasks file for nginx_install - name: Remove Sendmail yum: name: sendmail state: remove - name: Install Postfix yum: name: postfix state: present - name: Replace Domain replace: path: /etc/postfix/main.cf regexp: '\b(localhost)(\d*)\b' replace: 'smtp.gsmc.com' - name: Config Postfix blockinfile: path: /etc/postfix/main.cf block: | mydomain = gsmc.com myorigin = gsmc.com inet_interfaces = all inet_protocols = all mydestination = $myhostname, localhost.$mydomain, localhost mynetworks = 192.168.1.0/24, 127.0.0.0/8 home_mailbox = Maildir/ - name: Start Nginx systemd: state: started name: postfix