|
v5-1_srvgroup.yml:
- ---
- - name: Runing Mail Server
- hosts: serverb
- vars:
- v_mail_servers:
- - postfix
- - dovecot
- tasks:
- - name: Install Postfix
- yum:
- name: "{{ item }}"
- state: latest
- loop:
- "{{ v_mail_servers }}"
- - name: myorigin
- lineinfile:
- path: /etc/postfix/main.cf
- regexp: '^#myorigin = $mydomain'
- line: myorigin = $mydomain
- - name: inet_interfaces
- lineinfile:
- path: /etc/postfix/main.cf
- regexp: '^inet_interfaces = localhost'
- line: inet_interfaces = all
- - name: mydestination
- lineinfile:
- path: /etc/postfix/main.cf
- regexp: '^mydestination ='
- line: mydestination = $myhostname, localhost.$mydomain, localhost, lab.example.com
- - name: mynetwork
- lineinfile:
- path: /etc/postfix/main.cf
- line: mynetworks = 172.25.250.0/24, 127.0.0.0/8
- - name: login_trusted_networks
- lineinfile:
- path: /etc/dovecot/dovecot.conf
- regexp: '^#login_trusted_networks ='
- line: login_trusted_networks = 172.25.250.0/24
- - name: Mbox
- file:
- path: /home/student/mail/.imap/INBOX
- state: directory
- recurse: yes
- owner: student
- group: student
- setype: user_home_t
- - name: 10conf
- lineinfile:
- path: /etc/dovecot/conf.d/10-mail.conf
- line: mail_location = mbox:~/mail:INBOX=/var/mail/%u
- - name: Running Servers
- service:
- name: "{{ item }}"
- state: restarted
- enabled: yes
- loop:
- - postfix
- - dovecot
- - name: firewalld
- firewalld:
- service: smtp
- state: enabled
- permanent: yes
- immediate: yes
- - name: firewalld-dovecot
- firewalld:
- service: pop3
- state: enabled
- permanent: yes
- immediate: yes
复制代码
- Dec 12 21:05:20 serverb postfix/qmgr[17733]: 9D67920CE759: from=<student@lab.example.com>, size=334519, nrcpt=1 (queue active)
- Dec 12 21:05:20 serverb postfix/smtpd[18342]: disconnect from classroom.lab.example.com[172.25.250.254] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
- Dec 12 21:05:24 serverb postfix/smtp[18346]: 9D67920CE759: to=<18950350376@189.cn>, relay=mta-189.21cn.com[183.61.185.69]:25, delay=3.8, delays=0.2/0.04/2.1/1.4, dsn=5.0.0, status=bounced (host mta-189.21cn.com[183.61.185.69] said: 543 suspected spams or account(IP) exception (in reply to end of DATA command))
- Dec 12 21:05:24 serverb postfix/cleanup[18345]: 6B25820CE804: message-id=<20201212130524.6B25820CE804@serverb.lab.example.com>
- Dec 12 21:05:24 serverb postfix/bounce[18347]: 9D67920CE759: sender non-delivery notification: 6B25820CE804
- Dec 12 21:05:24 serverb postfix/qmgr[17733]: 6B25820CE804: from=<>, size=2762, nrcpt=1 (queue active)
- Dec 12 21:05:24 serverb postfix/qmgr[17733]: 9D67920CE759: removed
复制代码
|
|