我的ansible文件如下:
- name: hold docker-ce release
copy:
dest: /etc/apt/preferences.d/docker-ce
content: |
Package: docker-ce
Pin: version 5:18.09.7~3-0~ubuntu-xenial
Pin-Priority: 1002
- name: install docker-ce
apt:
name: docker-ce
update_cache: yes
我的目标系统当前已安装docker-ce=5:19.03.1~3-0~ubuntu-xenial
。在我运行时显示preferences.d/docker-ce
文件
apt install docker-ce
它正确地告诉我它将降级(根据首选项文件):
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be DOWNGRADED:
docker-ce
0 to upgrade, 0 to newly install, 1 to downgrade, 0 to remove and 10 not to upgrade.
Need to get 0 B/17.4 MB of archives.
After this operation, 23.2 MB disk space will be freed.
但是当我运行ansible时,这是输出:
TASK [docker_host : hold docker-ce release] *******
ok: [myhost.com]
TASK [docker_host : ensure docker is installed] ***
ok: [myhost.com]
并且ansible脚本无法将docker-ce的版本降级为preferences.d/docker-ce
中指定的版本
我怎么能运行等价的
apt install docker-ce
这样可以确定我的系统是根据我的ansible文件配置的吗?