Merge "[ansible] fixes for Anible 2.4 compat"
This commit is contained in:
commit
3c4f3ccf17
|
@ -85,6 +85,13 @@ class CallbackModule(object):
|
||||||
setup_log()
|
setup_log()
|
||||||
self.log = logging.getLogger(__name__)
|
self.log = logging.getLogger(__name__)
|
||||||
self.node = None
|
self.node = None
|
||||||
|
self.opts = {}
|
||||||
|
|
||||||
|
# NOTE(pas-ha) this method is required for Ansible>=2.4
|
||||||
|
# TODO(pas-ha) rewrite to support defining callback plugin options
|
||||||
|
# in ansible.cfg after we require Ansible >=2.4
|
||||||
|
def set_options(self, options):
|
||||||
|
self.opts = options
|
||||||
|
|
||||||
def runner_msg_dict(self, result):
|
def runner_msg_dict(self, result):
|
||||||
self.node = result._host.get_name()
|
self.node = result._host.get_name()
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
- name: clean block devices
|
- name: clean block devices
|
||||||
become: yes
|
become: yes
|
||||||
command: shred -f -z /dev/{{ item }}
|
command: shred -f -z /dev/{{ item.key }}
|
||||||
async: 3600
|
async: 3600
|
||||||
poll: 30
|
poll: 30
|
||||||
with_items: "{{ ansible_devices }}"
|
with_dict: "{{ ansible_devices }}"
|
||||||
|
when:
|
||||||
|
- item.value.host
|
||||||
|
|
|
@ -4,15 +4,21 @@
|
||||||
- 0
|
- 0
|
||||||
end_sectors:
|
end_sectors:
|
||||||
- "{{ (device.value.sectors | int) - sectors_to_wipe }}"
|
- "{{ (device.value.sectors | int) - sectors_to_wipe }}"
|
||||||
|
when:
|
||||||
|
- device.value.host
|
||||||
|
|
||||||
- name: update start and end sectors with such for partitions
|
- name: update start and end sectors with such for partitions
|
||||||
set_fact:
|
set_fact:
|
||||||
start_sectors: "{{ start_sectors + [item.value.start | int ] }}"
|
start_sectors: "{{ start_sectors + [item.value.start | int ] }}"
|
||||||
end_sectors: "{{ end_sectors + [ (item.value.start | int) + ( item.value.sectors | int) - sectors_to_wipe ] }}"
|
end_sectors: "{{ end_sectors + [ (item.value.start | int) + ( item.value.sectors | int) - sectors_to_wipe ] }}"
|
||||||
with_dict: "{{ device.value.partitions }}"
|
with_dict: "{{ device.value.partitions }}"
|
||||||
|
when:
|
||||||
|
- device.value.host
|
||||||
|
|
||||||
- name: wipe starts and ends of disks and partitions
|
- name: wipe starts and ends of disks and partitions
|
||||||
command: dd if=/dev/zero of=/dev/{{ device.key }} ibs={{ device.value.sectorsize }} obs={{ device.value.sectorsize }} count={{ sectors_to_wipe }} seek={{ item }}
|
command: dd if=/dev/zero of=/dev/{{ device.key }} ibs={{ device.value.sectorsize }} obs={{ device.value.sectorsize }} count={{ sectors_to_wipe }} seek={{ item }}
|
||||||
with_flattened:
|
with_flattened:
|
||||||
- "{{ start_sectors | map('int') | list | sort (reverse=True) }}"
|
- "{{ start_sectors | map('int') | list | sort (reverse=True) }}"
|
||||||
- "{{ end_sectors | map('int') | list | sort (reverse=True) }}"
|
- "{{ end_sectors | map('int') | list | sort (reverse=True) }}"
|
||||||
|
when:
|
||||||
|
- device.value.host
|
||||||
|
|
|
@ -12,3 +12,5 @@
|
||||||
become: yes
|
become: yes
|
||||||
command: sgdisk -Z /dev/{{ item.key }}
|
command: sgdisk -Z /dev/{{ item.key }}
|
||||||
with_dict: "{{ ansible_devices }}"
|
with_dict: "{{ ansible_devices }}"
|
||||||
|
when:
|
||||||
|
- item.value.host
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
when: ironic.root_device_hints is defined
|
when: ironic.root_device_hints is defined
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
ironic_root_device: /dev/{{ ansible_devices.keys()[0] }}
|
ironic_root_device: /dev/{{ item.key }}
|
||||||
when: ironic_root_device is undefined
|
with_dict: "{{ ansible_devices }}"
|
||||||
|
when:
|
||||||
|
- ironic_root_device is undefined
|
||||||
|
- item.value.host
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
ironic_image_target: "{{ ironic_root_device }}"
|
ironic_image_target: "{{ ironic_root_device }}"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
ansible>=2.1,!=2.2.1.0,!=2.1.4.0,<2.4
|
ansible>=2.1,!=2.2.1.0,!=2.1.4.0
|
||||||
|
|
Loading…
Reference in New Issue