Merge "[ansible] fixes for Anible 2.4 compat"

This commit is contained in:
Jenkins 2017-09-26 19:16:54 +00:00 committed by Gerrit Code Review
commit 3c4f3ccf17
6 changed files with 25 additions and 5 deletions

View File

@ -85,6 +85,13 @@ class CallbackModule(object):
setup_log()
self.log = logging.getLogger(__name__)
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):
self.node = result._host.get_name()

View File

@ -1,6 +1,8 @@
- name: clean block devices
become: yes
command: shred -f -z /dev/{{ item }}
command: shred -f -z /dev/{{ item.key }}
async: 3600
poll: 30
with_items: "{{ ansible_devices }}"
with_dict: "{{ ansible_devices }}"
when:
- item.value.host

View File

@ -4,15 +4,21 @@
- 0
end_sectors:
- "{{ (device.value.sectors | int) - sectors_to_wipe }}"
when:
- device.value.host
- name: update start and end sectors with such for partitions
set_fact:
start_sectors: "{{ start_sectors + [item.value.start | int ] }}"
end_sectors: "{{ end_sectors + [ (item.value.start | int) + ( item.value.sectors | int) - sectors_to_wipe ] }}"
with_dict: "{{ device.value.partitions }}"
when:
- device.value.host
- 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 }}
with_flattened:
- "{{ start_sectors | map('int') | list | sort (reverse=True) }}"
- "{{ end_sectors | map('int') | list | sort (reverse=True) }}"
when:
- device.value.host

View File

@ -12,3 +12,5 @@
become: yes
command: sgdisk -Z /dev/{{ item.key }}
with_dict: "{{ ansible_devices }}"
when:
- item.value.host

View File

@ -2,8 +2,11 @@
when: ironic.root_device_hints is defined
- set_fact:
ironic_root_device: /dev/{{ ansible_devices.keys()[0] }}
when: ironic_root_device is undefined
ironic_root_device: /dev/{{ item.key }}
with_dict: "{{ ansible_devices }}"
when:
- ironic_root_device is undefined
- item.value.host
- set_fact:
ironic_image_target: "{{ ironic_root_device }}"

View File

@ -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