我正在尝试使用剧本在 Ubuntu 中安装 Exim4。但是出现错误。我正在学习的过程中,ansible-playbook
如果有人可以在这里帮助如何实现这一点,那就太好了。我的 Ansible 书看起来像这样
- name: installing exim4.
remote_user: ubuntu
become: true
hosts: sample
tasks:
- name: Update apt repo and cache on all Debian/Ubuntu boxes
apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
- name: Upgrade all packages on servers
apt: upgrade=dist force_apt_get=yes
- name: Check if a reboot is needed on all servers
register: reboot_required_file
stat: path=/var/run/reboot-required get_md5=no
- name: Reboot the box if kernel updated
reboot:
msg: "Reboot initiated by Ansible for kernel updates"
connect_timeout: 5
reboot_timeout: 300
pre_reboot_delay: 0
post_reboot_delay: 30
test_command: uptime
when: reboot_required_file.stat.exists
- name: Installing Exim4.
ansible.builtin.expect:
command: dpkg-reconfigure exim4-config
responses:
General type of mail configuration: 'internet site; mail is sent and received directly using SMTP'
System mail name: 'ok-golen.yoursitetobe.com'
IP-addresses to listen on for incoming SMTP connections: '127.0.0.1 ; ::1'
Other destinations for which mail is accepted: 'golden-image'
Domains to relay mail for: ''
Machines to relay mail for: ''
Keep number of DNS-queries minimal (Dial-on-Demand)?: 'No'
Delivery method for local mail: 'Maildir format in the home directory'
Split configuration into small files?: 'No'
Root and postmaster mail recipient: 'root'
我不确定这是正确的方法。任何其他替代方式也值得赞赏。我收到以下错误。
fatal: [server1]: FAILED! => {"changed": true, "cmd": "dpkg-reconfigure exim4-config", "delta": "0:00:29.323447", "end": "2022-02-23 16:47:09.332278", "msg": "command exceeded timeout", "rc": null, "start": "2022-02-23 16:46:40.008831", "stdout": "\u001b[?1049h\u001b[22;0;0t\u001b[1;24r\u001b[4l\u001b[?25l\u001b(B\u001b[m\u001b[37m\u001b[40m\u001b[1;24r\u001b[H\u001b[2J\u001b[1;1H\u001b[1m\u001b[37m\u001b[45m \u001b[2;1H \u001b[3;1H \u001b[4;1H \u001b[5;1H \u001b[6;1H \u001b[7;1H \u001b[8;1H \u001b[9;1H \u001b[10;1H \u001b[11;1H \u001b[12;1H \u001b[13;1H \u001b[14;1H \u001b[15;1H \u001b[16;1H \u001b[17;1H \u001b[18;1H \u001b[19;1H \u001b[20;1H \u001b[21;1H \u001b[22;1H \u001b[23;1H \u001b[24;1H \u001b[24;79H \b\u001b[4h \u001b[4l\u001b[1;1H\u001b(B\u001b[m\u001b[37m\u001b[45mPackage configuration\u001b[4;2H\u001b[30m\u001b[47m┌───────────────────────┤ \u001b[31mMail Server configuration\u001b[30m ├───────────────────────┐\u001b[5;2H│ │\u001b[1m\u001b[37m\u001b[40m \u001b[6;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ Please select the mail server configuration type that best meets your │\u001b[1m\u001b[37m\u001b[40m \u001b[7;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ needs. │\u001b[1m\u001b[37m\u001b[40m \u001b[8;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[9;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ Systems with dynamic IP addresses, including dialup systems, should │\u001b[1m\u001b[37m\u001b[40m \u001b[10;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ generally be configured to send outgoing mail to another machine, called │\u001b[1m\u001b[37m\u001b[40m \u001b[11;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ a 'smarthost' for delivery because many receiving systems on the │\u001b[1m\u001b[37m\u001b[40m \u001b[12;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ Internet block incoming mail from dynamic IP addresses as spam │\u001b[1m\u001b[37m\u001b[40m \u001b[13;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ protection. │\u001b[1m\u001b[37m\u001b[40m \u001b[14;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[15;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ A system with a dynamic IP address can receive its own mail, or local │\u001b[1m\u001b[37m\u001b[40m \u001b[16;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ delivery can be disabled entirely (except mail for root and postmaster). │\u001b[1m\u001b[37m\u001b[40m \u001b[17;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[18;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ \u001b[37m\u001b[41m<Ok>\u001b[30m\u001b[47m │\u001b[1m\u001b[37m\u001b[40m \u001b[19;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[20;2H\u001b(B\u001b[m\u001b[30m\u001b[47m└───────────────────────────────────────────────────────────────────────────┘\u001b[1m\u001b[37m\u001b[40m \u001b[21;3H \u001b[18;38H", "stdout_lines": ["\u001b[?1049h\u001b[22;0;0t\u001b[1;24r\u001b[4l\u001b[?25l\u001b(B\u001b[m\u001b[37m\u001b[40m\u001b[1;24r\u001b[H\u001b[2J\u001b[1;1H\u001b[1m\u001b[37m\u001b[45m \u001b[2;1H \u001b[3;1H \u001b[4;1H \u001b[5;1H \u001b[6;1H \u001b[7;1H \u001b[8;1H \u001b[9;1H \u001b[10;1H \u001b[11;1H \u001b[12;1H \u001b[13;1H \u001b[14;1H \u001b[15;1H \u001b[16;1H \u001b[17;1H \u001b[18;1H \u001b[19;1H \u001b[20;1H \u001b[21;1H \u001b[22;1H \u001b[23;1H \u001b[24;1H \u001b[24;79H \b\u001b[4h \u001b[4l\u001b[1;1H\u001b(B\u001b[m\u001b[37m\u001b[45mPackage configuration\u001b[4;2H\u001b[30m\u001b[47m┌───────────────────────┤ \u001b[31mMail Server configuration\u001b[30m ├───────────────────────┐\u001b[5;2H│ │\u001b[1m\u001b[37m\u001b[40m \u001b[6;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ Please select the mail server configuration type that best meets your │\u001b[1m\u001b[37m\u001b[40m \u001b[7;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ needs. │\u001b[1m\u001b[37m\u001b[40m \u001b[8;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[9;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ Systems with dynamic IP addresses, including dialup systems, should │\u001b[1m\u001b[37m\u001b[40m \u001b[10;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ generally be configured to send outgoing mail to another machine, called │\u001b[1m\u001b[37m\u001b[40m \u001b[11;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ a 'smarthost' for delivery because many receiving systems on the │\u001b[1m\u001b[37m\u001b[40m \u001b[12;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ Internet block incoming mail from dynamic IP addresses as spam │\u001b[1m\u001b[37m\u001b[40m \u001b[13;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ protection. │\u001b[1m\u001b[37m\u001b[40m \u001b[14;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[15;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ A system with a dynamic IP address can receive its own mail, or local │\u001b[1m\u001b[37m\u001b[40m \u001b[16;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ delivery can be disabled entirely (except mail for root and postmaster). │\u001b[1m\u001b[37m\u001b[40m \u001b[17;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[18;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ \u001b[37m\u001b[41m<Ok>\u001b[30m\u001b[47m │\u001b[1m\u001b[37m\u001b[40m \u001b[19;2H\u001b(B\u001b[m\u001b[30m\u001b[47m│ │\u001b[1m\u001b[37m\u001b[40m \u001b[20;2H\u001b(B\u001b[m\u001b[30m\u001b[47m└───────────────────────────────────────────────────────────────────────────┘\u001b[1m\u001b[37m\u001b[40m \u001b[21;3H \u001b[18;38H"]}