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

437 views
Skip to first unread message

John Himpel

unread,
Mar 18, 2022, 8:05:16 PM3/18/22
to Ansible Project
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]: 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

Stefan Hornburg (Racke)

unread,
Mar 21, 2022, 2:44:42 AM3/21/22
to ansible...@googlegroups.com
Try with a recent version of Ansible.

Regards
Racke

>
> --
> 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 ansible-proje...@googlegroups.com <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/11cb52e9-3c7e-4714-94d5-739d56bcdbdan%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/11cb52e9-3c7e-4714-94d5-739d56bcdbdan%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Automation expert - Ansible and friends
Linux administrator & Debian maintainer
Perl Dancer & conference hopper

OpenPGP_signature

John Himpel

unread,
Mar 22, 2022, 3:09:35 PM3/22/22
to Ansible Project
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. 

Reply all
Reply to author
Forward
0 new messages