为什么 Ansible apt 模块安装软件包也会删除其他软件包

为什么 Ansible apt 模块安装软件包也会删除其他软件包

我正在尝试使用 Ansible 任务在 Debian 机器上安装一堆软件包

- name: Run the equivalent of "apt-get update"
  apt:
    update_cache: true
    autoclean: true
    
- name: Install latest packages
  apt:
    name: "{{ packages }}"
    state: latest
    force: true
    autoclean: true
  vars:
    packages:
    - tcpdump
    - vim
    - locales
    - lsof
    - netcat
    .
    .
    etc

当我以详细方式运行 ansible-playbook 时,我可以看到它还删除了一些 imp 包。

The following packages were automatically installed and are no longer required:

      libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0
      libxcb-shape0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxcb1-dev
      libxcomposite1 libxcursor1 libxdamage1 libxdmcp-dev libxfixes3 libxft2
      libxinerama1 libxkbcommon0 libxmu6 libxpm4 libxrandr2 libxshmfence1
      libxt-dev libxt6 libxv1 libxxf86dga1 libxxf86vm1 openjdk-8-jdk
      openjdk-8-jdk-headless openjdk-8-jre x11-utils x11proto-core-dev
      x11proto-input-dev x11proto-kb-dev xkb-data xorg-sgml-doctools xtrans-dev
    Use 'apt autoremove' to remove them.
    The following additional packages will be installed:
      libestr0 liblogging-stdlog0 liblognorm5
    Suggested packages:
      rsyslog-mysql | rsyslog-pgsql rsyslog-mongodb rsyslog-doc rsyslog-gnutls
      rsyslog-gssapi rsyslog-relp
    The following packages will be REMOVED:
      cosmos-base cosmos-jmx  stream-relay
    The following NEW packages will be installed:
      libestr0 libfastjson4 liblogging-stdlog0 liblognorm5 rsyslog
    0 upgraded, 5 newly installed, 9 to remove and 69 not upgraded.
    Need to get 655 kB of archives.
    After this operation, 13.8 MB disk space will be freed.
    Get:1 http://10.19.1.12/debian stretch/main amd64 libestr0 amd64 0.1.10-2 [8450 B]
    Get:2 http://10.19.1.12/debian stretch/main amd64 liblogging-stdlog0 amd64 1.0.5-2+b2 [12.6 kB]
    Get:3 http://10.19.1.12/debian stretch/main amd64 libfastjson4 amd64 0.99.4-1 [22.7 kB]
    Get:4 http://10.19.1.12/debian stretch/main amd64 liblognorm5 amd64 2.0.1-1.1+b1 [57.7 kB]
    Get:5 http://10.19.1.12/debian stretch/main amd64 rsyslog amd64 8.24.0-1 [553 kB]
    Fetched 655 kB in 0s (51.8 MB/s)
    (Reading database ... (Reading database ... 5%(Reading database ... 10%(Reading database ... 15%(Reading database ... 20%(Reading database ... 25%(Reading database ... 30%(Reading database ... 35%(Reading database ... 40%(Reading database ... 45%(Reading database ... 50%(Reading database ... 55%(Reading database ... 60%(Reading database ... 65%(Reading database ... 70%(Reading database ... 75%(Reading database ... 80%(Reading database ... 85%(Reading database ... 90%(Reading database ... 95%(Reading database ... 100%(Reading database ... 52273 files and directories currently installed.)
    Removing cosmos-jmx (3.0.15) ...
    dpkg: warning: while removing cosmos-jmx, directory '/etc/sv/cosmos-jmx/log' not empty so not removed
    Removing cosmos-base (3.0.12) ...
    Removing stream-relay (1.8.0-6) ...

为什么当我尝试安装时它会删除软件包?解决办法是什么?

相关内容