--- - hosts: freebsdservers gather_facts: true become: true vars: jails: - aa-torrenting tasks: - name: Update all installed packages community.general.pkgng: name: "*" state: latest - name: Update all installed packages in jails community.general.pkgng: name: "*" state: latest jail: "{{ item }}" with_items: "{{ jails }}" - name: Fetch and install updates ansible.builtin.shell: freebsd-update fetch install register: updated changed_when: '"No updates are available to install." not in updated.stdout' - name: Fetch and install updates in aa-torrenting jail ansible.builtin.shell: freebsd-update -j aa-torrenting fetch install register: updated_aa_torrenting changed_when: '"No updates are available to install." not in updated_aa_torrenting.stdout'