我有一本包含以下任务的 ansible 剧本
- name: Get aptitude for upgrade
apt: pkg=aptitude state=present
- name: Update APT package cache
apt: update_cache=yes cache_valid_time=3600
当我添加
- name: Upgrade APT to the latest packages
apt: upgrade=safe
eth0 接口神奇地消失了。
猫/等/网络/接口:
auto lo
iface lo inet loopback
auto etho0
iface eth0 inet dhcp
是否配置apt: upgrade=safe 之前:
eth0 Link encap:Ethernet HWaddr b8:27:eb:9e:16:fd
inet addr:192.168.1.161 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::ba27:ebff:fe9e:16fd/64 Scope:Link
inet6 addr: 2002:5e4f:b23c:1234:ba27:ebff:fe9e:16fd/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:95254 errors:0 dropped:0 overruns:0 frame:0
TX packets:30815 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:136917073 (136.9 MB) TX bytes:2880058 (2.8 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
之后:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:160 errors:0 dropped:0 overruns:0 frame:0
TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11840 (11.8 KB) TX bytes:11840 (11.8 KB)
我正在运行全新的 Ubuntu 服务器 16.04 LTS。知道为什么 eth0 会消失吗?显然 apt: upgrade=safe 是问题所在,但为什么呢?
配置文件令人惊讶的是给出了不同的输出,但是 eth0 仍然缺失:
答案1
安装网络管理器后问题消失
- name: Get network-manager
apt: state=installed pkg=network-manager