2024-06-12 11:22:54 +02:00
|
|
|
---
|
|
|
|
- name: Check if iocage is available
|
|
|
|
stat:
|
|
|
|
path: /usr/local/bin/iocage
|
|
|
|
tags:
|
|
|
|
- always
|
|
|
|
register: iocage_available
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: List iocage jails
|
|
|
|
command:
|
|
|
|
cmd: /usr/local/bin/iocage list -H
|
|
|
|
check_mode: false
|
|
|
|
register: iocage_list_jails
|
|
|
|
|
|
|
|
- name: show results of list jails (iocage)
|
|
|
|
debug:
|
|
|
|
verbosity: 1
|
|
|
|
var: iocage_list_jails
|
|
|
|
|
|
|
|
- name: set iocage jails
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
iocage_jails: '{{ iocage_list_jails.stdout_lines | map("split") }}'
|
|
|
|
|
|
|
|
- name: Install updates (iocage)
|
|
|
|
command:
|
|
|
|
cmd: '/usr/local/bin/iocage update {{ item.1 }}'
|
|
|
|
environment:
|
|
|
|
PAGER: cat
|
|
|
|
when: item.2 == 'up' and item.3 == ansible_distribution_version + '-RELEASE'
|
|
|
|
loop: '{{ iocage_jails }}'
|
|
|
|
loop_control:
|
|
|
|
label: 'iocage update {{ item.1 }}'
|
|
|
|
register: installupdates_iocage
|
|
|
|
|
|
|
|
- name: show results of install updates (iocage)
|
|
|
|
debug:
|
|
|
|
verbosity: 1
|
|
|
|
msg: |
|
2024-06-12 13:30:13 +02:00
|
|
|
{% if item.false_condition is not defined -%}
|
2024-06-12 11:22:54 +02:00
|
|
|
Results of {{ item.cmd | join(' ') }}
|
|
|
|
{{ item.stdout | default(item.msg | default('No message')) }}
|
2024-06-12 13:30:13 +02:00
|
|
|
{% else %}
|
|
|
|
Update of {{ item.item.1 }} skipped due to the following conditional(s) being false
|
|
|
|
* {{ item.item.2 }} == 'up'
|
|
|
|
* {{ item.item.3 }} == {{ ansible_distribution_version }}-RELEASE
|
|
|
|
{% endif -%}
|
2024-06-12 11:22:54 +02:00
|
|
|
loop: '{{ installupdates_iocage.results }}'
|
|
|
|
loop_control:
|
2024-06-12 13:30:13 +02:00
|
|
|
label: 'Update of {{ item.item.1 }}'
|
2024-06-12 11:22:54 +02:00
|
|
|
when: installupdates_iocage
|
|
|
|
when: iocage_available.stat.exists
|