apt result is changed incorrectly?

15 views
Skip to first unread message

Barry Kaplan

unread,
Oct 24, 2018, 11:42:40 AM10/24/18
to Ansible Project
I am running apt with a wildcard. The package is not being installed/updated, but task is marked as changed. Is this is a bug or how I should expect apt to work with a wildcard.


ansible ansible --version
ansible
2.6.5


    - name: Install python
      apt
:
        name
: python2.7='2.7.14-2ubuntu1~14.04.york1'
        state
: present
        update_cache
: yes
     
register: _apt_python
   
- debug: var=_apt_python
   
- fail:


TASK [debug] **************************************************************************************************************************************************************************************************************************************
ok
: [10.11.140.238] => {
   
"_apt_python": {
       
"cache_update_time": 1540395343,
       
"cache_updated": true,
       
"changed": true,
       
"diff": {},
       
"failed": false,
       
"stderr": "",
       
"stderr_lines": [],
       
"stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\npython2.7 is already the newest version.\n0 upgraded, 0 newly installed, 0 to remove and 120 not upgraded.\n",
       
"stdout_lines": [
           
"Reading package lists...",
           
"Building dependency tree...",
           
"Reading state information...",
           
"python2.7 is already the newest version.",
           
"0 upgraded, 0 newly installed, 0 to remove and 120 not upgraded."
       
]
   
}
}

Barry Kaplan

unread,
Oct 24, 2018, 11:43:35 AM10/24/18
to Ansible Project
Sorry, posted the wrong version expression

    - name: Install python
      apt
:

        name
: python2.7='2.7.14*'

Barry Kaplan

unread,
Oct 24, 2018, 11:45:24 AM10/24/18
to Ansible Project
I posted the non-wildcard version above. But that too marks the task as changed. Which then is very different from what I would expect.

Vladimir Botka

unread,
Oct 25, 2018, 12:17:35 AM10/25/18
to Ansible Project
You asked apt to update the cache

     update_cache: yes

The cache was updated and the task was flagged "changed".
Reply all
Reply to author
Forward
0 new messages