Change heketi-tear-down to run on nodes instead of localhost delegate_to

pull/2931/head
Simon Li 2018-07-27 16:33:43 +01:00 committed by Sascha Marcel Schmidt
parent 8ac57201a7
commit d284961d47
No known key found for this signature in database
GPG Key ID: D1D6CE184437796D
3 changed files with 12 additions and 17 deletions

View File

@ -1,4 +1,9 @@
---
- hosts: localhost
- hosts: kube-master[0]
roles:
- { role: tear-down }
- hosts: heketi-node
become: yes
roles:
- { role: tear-down-disks }

View File

@ -1,6 +1,5 @@
---
- name: "Install lvm utils (RedHat)"
delegate_to: "{{ node }}"
become: true
yum:
name: "lvm2"
@ -8,34 +7,31 @@
when: "ansible_os_family == 'RedHat'"
- name: "Install lvm utils (Debian)"
delegate_to: "{{ node }}"
become: true
apt:
name: "lvm2"
state: "present"
when: "ansible_os_family == 'Debian'"
- name: "Get volume group information."
delegate_to: "{{ node }}"
become: true
shell: "pvs {{ disk }} --option vg_name | tail -n+2"
vars: { disk: "{{ hostvars[node]['disk_volume_device_1'] }}" }
shell: "pvs {{ disk_volume_device_1 }} --option vg_name | tail -n+2"
register: "volume_groups"
ignore_errors: true
changed_when: false
- name: "Remove volume groups."
delegate_to: "{{ node }}"
become: true
command: "vgremove {{ volume_group }} --yes"
with_items: "{{ volume_groups.stdout_lines }}"
loop_control: { loop_var: "volume_group" }
- name: "Remove physical volume from cluster disks."
delegate_to: "{{ node }}"
become: true
command: "pvremove {{ disk }} --yes"
vars: { disk: "{{ hostvars[node]['disk_volume_device_1'] }}" }
command: "pvremove {{ disk_volume_device_1 }} --yes"
ignore_errors: true
- name: "Remove lvm utils (RedHat)"
delegate_to: "{{ node }}"
become: true
yum:
name: "lvm2"
@ -43,7 +39,6 @@
when: "ansible_os_family == 'RedHat'"
- name: "Remove lvm utils (Debian)"
delegate_to: "{{ node }}"
become: true
apt:
name: "lvm2"

View File

@ -49,8 +49,3 @@
command: "{{ bin_dir }}/kubectl delete secret {{ secrets.stdout|from_json|json_query(storage_query) }}"
when: "storage_query is defined"
ignore_errors: true
- name: "Prepare cluster disks."
include_tasks: "disks.yml"
with_items: "{{ groups['heketi-node'] }}"
loop_control:
loop_var: "node"