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

-- 
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-project+unsubscr...@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.

Reply via email to