Commit 08231b36 authored by Pietsch, Martin's avatar Pietsch, Martin

added evaluation of creationtime from jail properties

parent 78f669e2
......@@ -26,6 +26,10 @@
set_fact:
fubdir: "{{ cstate.path }}"
- name: get creation time of jail
set_fact:
ctime: "{{ cstate.creationtime }}"
- name: set variable of package update for jails
set_fact:
pujail: "{{ container.jailname }}"
......@@ -47,18 +51,18 @@
- name: set update result of host to return value upgraded
set_fact:
upgraded: "{{ upgraded | combine({ 'host': _upgradestate }) }}"
upgraded: "{{ upgraded | combine({ 'host': {'state': _upgradestate, 'creationtime': '0'}}) }}"
when: container is not defined
- block:
- name: set update result of jail to return value upgraded
set_fact:
upgraded: "{{ upgraded | combine({ container.jailname: _upgradestate }) }}"
upgraded: "{{ upgraded | combine({ container.jailname: {'state': _upgradestate, 'creationtime': ctime}}) }}"
- name: restart jail
jail:
name: "{{ container.jailname }}"
state: restart
when: upgraded[container.jailname] == True and upgraded["host"] == False
when: upgraded[container.jailname].state == True and upgraded["host"].state == False
when: container is defined
......@@ -13,7 +13,7 @@
migrationhostip: "{{ hostvars[migrationhost].network.devices[hostvars[migrationhost].network.control_device].ipv4 | default(hostvars[migrationhost].network.devices[hostvars[migrationhost].network.control_device].ipv6) }}"
- include_tasks: _doupgrade.yml
when: system_upgrade_states[migrationhost].host == True
when: system_upgrade_states[migrationhost].host.state == True
- name: gathering all jail container
jail:
......@@ -26,14 +26,14 @@
state: migrate
create_nullfs: True
migration_host: "{{ migrationhostip }}"
when: (not (_container.key in contlist.jails) or _container.value == True) and _container.key != 'host'
when: (not (_container.key in contlist.jails) or _container.value.state == True or ((contlist.jails[_container.key] | default({})).creationtime | default("0")) != _container.value.creationtime) and _container.key != 'host'
loop: "{{ system_upgrade_states[migrationhost] | default({}) | dict2items }}"
loop_control:
loop_var: _container
- name: set variable that controls the reboot of the host
set_fact:
doreboot: "{{ system_upgrade_states[migrationhost].host }}"
doreboot: "{{ system_upgrade_states[migrationhost].host.state }}"
when: system_upgrade_states is defined
- block:
......@@ -55,7 +55,7 @@
- name: set variable that controls the reboot of the host
set_fact:
doreboot: "{{ system_upgrade_states[inventory_hostname].host }}"
doreboot: "{{ system_upgrade_states[inventory_hostname].host.state }}"
when: system_upgrade_states is not defined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment