Löschen VM

From
Revision as of 08:57, 23 October 2019 by Daniel (talk | contribs) (Created page with "<pre> --- - hosts: all gather_facts: false connection: local user: remote vars: vcenter_hostname: 'IP' vcenter_user: 'administrator@testlab.lan' vcenter_p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
---
- hosts: all
  gather_facts: false
  connection: local
  user: remote

  vars:
    vcenter_hostname: 'IP'
    vcenter_user: 'administrator@testlab.lan'
    vcenter_pass: 'PASSWORD'
    datacenter: 'testlab'
    esxi_host: 'IP'
    notes: 'Created by Ansible'
  tasks:
    - vsphere_guest:
        validate_certs: False
        vcenter_hostname: "{{ vcenter_hostname }}"
        username: "{{ vcenter_user }}"
        password: "{{ vcenter_pass }}"
        guest: "{{ inventory_hostname }}"
        state: absent
        force: yes

    - name: delete forward lookup entry DNS"
      nsupdate:
       key_name: "testlab.lan"
       key_secret: "U93nnwyHGYr20Ro6YNTDng=="
       server: "172.16.0.1"
       zone: "testlab.lan."
       record: "{{ inventory_hostname }}"
       value: "{{ip}}"
       state: absent

    - name: delete reverse lookup entry DNS"
      nsupdate:
       key_name: "testlab.lan"
       key_secret: "U93nnwyHGYr20Ro6YNTDng=="
       server: "172.16.0.1"
       zone: "16.172.in-addr.arpa"
       type: PTR
       record: "{{ rip }}"
       value: "{{ inventory_hostname }}.testlab.lan."
       state: absent