# apt result is changed incorrectly?

**URL:** <https://forum.ansible.com/t/apt-result-is-changed-incorrectly/28864>\
**Category:** Ansible Project\
**Created:** [October 24, 2018, 3:42pm UTC](https://forum.ansible.com/t/apt-result-is-changed-incorrectly/28864 "2018-10-24T15:42:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [October 24, 2018, 3:42pm UTC](https://forum.ansible.com/t/apt-result-is-changed-incorrectly/28864/1 "2018-10-24T15:42:40Z")

</div>

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."] } }`

---

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [October 24, 2018, 3:43pm UTC](https://forum.ansible.com/t/apt-result-is-changed-incorrectly/28864/2 "2018-10-24T15:43:35Z")

</div>

Sorry, posted the wrong version expression

`

- name: Install python  
apt:  
name: python2.7=‘2.7.14\*’  
state: present  
update\_cache: yes  
register: \_apt\_python
- debug: var=\_apt\_python
- fail:

`

---

<div class="post-metadata">

**Author:** ![Barry\_Kaplan](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@Barry\_Kaplan](https://forum.ansible.com/u/Barry_Kaplan)\
**Post date:** [October 24, 2018, 3:45pm UTC](https://forum.ansible.com/t/apt-result-is-changed-incorrectly/28864/3 "2018-10-24T15:45:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [October 25, 2018, 4:17am UTC](https://forum.ansible.com/t/apt-result-is-changed-incorrectly/28864/4 "2018-10-25T04:17:35Z")

</div>

You asked apt to update the cache

update\_cache: yes

The cache was updated and the task was flagged “changed”.

“cache\_update\_time”: 1540395343,  
“cache\_updated”: true,  
“changed”: true,
