summaryrefslogtreecommitdiffstats
path: root/deployment/playbooks/cleanup-cns.yaml
blob: 5a2d849715e2b3cf12f568b6eea0ff3dd1c35c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
- hosts: localhost
  user: root
  become: false
  ignore_errors: yes
  vars_files:
    - vars/main.yaml
  roles:
    - instance-groups

- hosts: cns
  user: root
  become: false
  ignore_errors: yes
  vars_files:
    - vars/main.yaml
  roles:
    - rhsm-unregister

- hosts: localhost
  user: root
  become: false
  ignore_errors: yes
  vars_files:
    - vars/main.yaml
  tasks:
    - name: Delete cns VMs
      vmware_guest:
        hostname: "{{ vcenter_host }}"
        username: "{{ vcenter_username }}"
        password: "{{ vcenter_password }}"
        datacenter: "{{ vcenter_datacenter }}"
        folder: "/{{ vcenter_folder }}"
        name: "{{ item.value.guestname }}"
        state: absent
        force: true
      with_dict: "{{host_inventory}}"
      when: "'cns' in item.value.guestname"