Skip to content

Commit

Permalink
[contrib/heketi]: tear down additions and fixes. Heketi updated to ve…
Browse files Browse the repository at this point in the history
…rsion 9 (kubernetes-sigs#5027)

* lvm packages removal during tear down skipped by default
  * lvm utils execution PATH fixed for CentOS/RH
  * Heketi updated to the latest version 9

Signed-off-by: Vitaliy Dmitriev <vi7alya@gmail.com>
  • Loading branch information
vi7 authored and LuckySB committed Aug 5, 2019
1 parent b85fbb3 commit e1e6efb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions contrib/network-storage/heketi/README.md
Expand Up @@ -14,3 +14,5 @@ ansible-playbook --ask-become -i inventory/sample/k8s_heketi_inventory.yml contr
```
ansible-playbook --ask-become -i inventory/sample/k8s_heketi_inventory.yml contrib/network-storage/heketi/heketi-tear-down.yml
```

Add `--extra-vars "heketi_remove_lvm=true"` to the command above to remove LVM packages from the system
Expand Up @@ -56,7 +56,7 @@
"serviceAccountName": "heketi-service-account",
"containers": [
{
"image": "heketi/heketi:7",
"image": "heketi/heketi:9",
"imagePullPolicy": "Always",
"name": "deploy-heketi",
"env": [
Expand Down
Expand Up @@ -68,7 +68,7 @@
"serviceAccountName": "heketi-service-account",
"containers": [
{
"image": "heketi/heketi:7",
"image": "heketi/heketi:9",
"imagePullPolicy": "Always",
"name": "heketi",
"env": [
Expand Down
@@ -0,0 +1,2 @@
---
heketi_remove_lvm: false
Expand Up @@ -14,19 +14,25 @@
when: "ansible_os_family == 'Debian'"

- name: "Get volume group information."
environment:
PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
become: true
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."
environment:
PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
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."
environment:
PATH: "{{ ansible_env.PATH }}:/sbin" # Make sure we can workaround RH / CentOS conservative path management
become: true
command: "pvremove {{ disk_volume_device_1 }} --yes"
ignore_errors: true
Expand All @@ -36,11 +42,11 @@
yum:
name: "lvm2"
state: "absent"
when: "ansible_os_family == 'RedHat'"
when: "ansible_os_family == 'RedHat' and heketi_remove_lvm"

- name: "Remove lvm utils (Debian)"
become: true
apt:
name: "lvm2"
state: "absent"
when: "ansible_os_family == 'Debian'"
when: "ansible_os_family == 'Debian' and heketi_remove_lvm"

0 comments on commit e1e6efb

Please sign in to comment.