# ansible.builtin.apt - Updating all installed packages to latest gives "parameters are mutually exclusive deb|package|upgrade

**URL:** <https://forum.ansible.com/t/ansible-builtin-apt-updating-all-installed-packages-to-latest-gives-parameters-are-mutually-exclusive-deb-package-upgrade/36460>\
**Category:** Ansible Project\
**Tags:** fedora, ubuntu\
**Created:** [March 19, 2022, 12:05am UTC](https://forum.ansible.com/t/ansible-builtin-apt-updating-all-installed-packages-to-latest-gives-parameters-are-mutually-exclusive-deb-package-upgrade/36460 "2022-03-19T00:05:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Himpel](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@John\_Himpel](https://forum.ansible.com/u/John_Himpel)\
**Post date:** [March 19, 2022, 12:05am UTC](https://forum.ansible.com/t/ansible-builtin-apt-updating-all-installed-packages-to-latest-gives-parameters-are-mutually-exclusive-deb-package-upgrade/36460/1 "2022-03-19T00:05:15Z")

</div>

The following ansible block:

- name: Block update APT hosts  
block:

- name: main - Update APT repo and cache  
ansible.builtin.apt:  
update\_cache: true  
force\_apt\_get: true  
cache\_valid\_time: 3600 # 1 Hour

- name: main - Update APT hosts  
ansible.builtin.apt:  
upgrade: dist  
force\_apt\_get: true  
register: apt\_return

- name: main - Display APT log  
ansible.builtin.debug:  
var: apt\_return.stdout\_lines  
when: apt\_return.stdout\_lines is defined

- name: main - Check if reboot is needed  
ansible.builtin.stat:  
path: /var/run/reboot-required  
get\_md5: false  
register: reboot\_required\_file

- name: main - Reboot APT host  
ansible.builtin.reboot:  
msg: “Reboot initiated by Ansible due to kernel updates”  
connect\_timeout: 5  
reboot\_timeout: 300  
pre\_reboot\_delay: 0  
post\_reboot\_delay: 30  
test\_command: uptime  
when: reboot\_required\_file.stat.exists  
when: ansible\_pkg\_mgr == “apt”  
become: true

Yields:  
TASK [update\_software : main - update APT hosts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [[testRadicale.jlhimpel.net](http://testRadicale.jlhimpel.net)]: FAILED! =\> {“changed”: false, “msg”: “parameters are mutually exclusive: deb|package|upgrade”}

Ansible version: 2.2.12  
Python version: 3.10.3  
Ansible Controller: Fedora 36 (same issue occurs on Fedora 35)  
Ansible target: Ubuntu 18.04.5 (Bionic Beaver)  
Ansible target: python 3…6.9

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [March 21, 2022, 6:44am UTC](https://forum.ansible.com/t/ansible-builtin-apt-updating-all-installed-packages-to-latest-gives-parameters-are-mutually-exclusive-deb-package-upgrade/36460/2 "2022-03-21T06:44:18Z")

</div>

> The following ansible block:  
> - name: Block update APT hosts  
> block:  
> - name: main - Update APT repo and cache  
> ansible.builtin.apt:  
> update\_cache: true  
> force\_apt\_get: true  
> cache\_valid\_time: 3600 # 1 Hour
> 
> ```
> \- name: main \- Update APT hosts
> ansible\.builtin\.apt:
> upgrade: dist
> force\_apt\_get: true
> register: apt\_return
> 
> \- name: main \- Display APT log
> ansible\.builtin\.debug:
> var: apt\_return\.stdout\_lines
> when: apt\_return\.stdout\_lines is defined
> 
> \- name: main \- Check if reboot is needed
> ansible\.builtin\.stat:
> path: /var/run/reboot\-required
> get\_md5: false
> register: reboot\_required\_file
> 
> \- name: main \- Reboot APT host
> ansible\.builtin\.reboot:
> msg: &quot;Reboot initiated by Ansible due to kernel updates&quot;
> connect\_timeout: 5
> reboot\_timeout: 300
> pre\_reboot\_delay: 0
> post\_reboot\_delay: 30
> test\_command: uptime
> when: reboot\_required\_file\.stat\.exists
> 
> ```
> 
> when: ansible\_pkg\_mgr == "apt"  
> become: true
> 
> Yields:  
> TASK [update\_software : main - update APT hosts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> fatal: [testRadicale.jlhimpel.net]: FAILED! =\> {"changed": false, "msg": "parameters are mutually exclusive: deb|package|upgrade"}
> 
> Ansible version: 2.2.12  
> Python version: 3.10.3  
> Ansible Controller: Fedora 36 (same issue occurs on Fedora 35)  
> Ansible target: Ubuntu 18.04.5 (Bionic Beaver)  
> Ansible target: python 3..6.9

Try with a recent version of Ansible.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![John\_Himpel](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@John\_Himpel](https://forum.ansible.com/u/John_Himpel)\
**Post date:** [March 22, 2022, 7:09pm UTC](https://forum.ansible.com/t/ansible-builtin-apt-updating-all-installed-packages-to-latest-gives-parameters-are-mutually-exclusive-deb-package-upgrade/36460/3 "2022-03-22T19:09:35Z")

</div>

I found the issue.

I inadvertently pointed my IDE to a version of the source not located on the ansible controller node. Thus a mismatch between what I was viewing/editing and what was editing.

Operator error. ☹

Sorry for the noise.
