On 28. juli 2016 07:54,
richar...@gmail.com wrote:
> Thanks for you suggestion but I just get this when use you way
>
> ```
> - name: upgrade docker-engine
> apt:
> name: docker-engine
> only_upgrade: docker-engine
> # state: latest
> ```
>
> ```
> TASK [upgrade docker-engine]
> ***************************************************
> ok: [xx.xx.xx.xx]
>
> ```
>
> and if I add state:latest, I just think only_upgrade is not work , because
> I also can install the latest version without only_upgrade
I'm not sure I understand you, my test of only_upgrade
$ dpkg -l htop
dpkg-query: no packages found matching htop
I run this task:
- name: upgrade if exist
apt:
name=htop
state=latest
only_upgrade=true
The output:
TASK [upgrade if exist]
********************************************************
changed: [localhost]
stdout: Reading package lists...
Building dependency tree...
Reading state information...
Skipping htop, it is not installed and only upgrades are requested.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
As you see, nothing was installed and this confirms it
$ dpkg -l htop
dpkg-query: no packages found matching htop
So the only_upgrade is working in Ansible 2.1.0.
The apt module is using the apt-get command and only_upgrade=true adds
--only-upgrade as an option to apt-get.
--
Kai Stian Olstad