On 28. juli 2016 07:54, [email protected] 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

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/312ce730-85ab-04ca-0b05-91b4226c9639%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to