Try to fix access to var item result

This commit is contained in:
Jeffrey Serio 2025-02-26 20:43:18 -06:00
parent b8c55055df
commit c50ea25396

View File

@ -22,15 +22,10 @@
- name: Run freebsd-update fetch
ansible.builtin.command: freebsd-update fetch
- name: Check if updates are ready
ansible.builtin.command: freebsd-update updatesready
register: updatesready
- name: Upgrade the system
ansible.builtin.command: freebsd-update install
register: upgraded
when:
- updatesready.rc == 0
changed_when: upgraded.rc == 0
- name: Reboot may be necessary
ansible.builtin.debug:
@ -42,20 +37,15 @@
ansible.builtin.command: "freebsd-update fetch -j {{ item }}"
with_items: "{{ jails }}"
- name: Check if updates are ready in jails
ansible.builtin.command: "freebsd-update updatesready -j {{ item }}"
register: updatesready_jails
with_items: "{{ jails }}"
- name: Upgrade the jails
ansible.builtin.command: "freebsd-update install -j {{ item }}"
register: upgraded_jails
changed_when: upgraded_jails.item.rc == 0
with_items: "{{ jails }}"
when:
- updatesready_jails.rc == 0
- name: Reboot of jail may be necessary
ansible.builtin.debug:
msg: "A system reboot may be necessary for this jail."
when:
- upgraded_jails.rc == 0
- upgraded_jails.item.rc == 0
with_items: "{{ jails }}"