summaryrefslogtreecommitdiff
path: root/test/integration/targets/vmware_host_dns/tasks/main.yml
blob: 2c247c515d67ae81f8fe45ae5b1ed81b8ec9012c (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
# Test code for the vmware_host_dns module.
# Copyright: (c) 2019, Mario Lenz <m@riolenz.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# This tests assume that all ESXi hosts either have a static or a dynamic DNS
# configuration. They probably will fail if on host is 'static' and the other
# is 'dhcp' configured.
- when: vcsim is not defined
  block:
    - import_role:
        name: prepare_vmware_tests
      vars:
        setup_attach_host: true

    - name: Gather DNS facts about ESXi Host
      vmware_host_dns_info:
        hostname: '{{ vcenter_hostname }}'
        username: '{{ vcenter_username }}'
        password: '{{ vcenter_password }}'
        esxi_hostname: "{{ item }}"
        validate_certs: False
      loop: "{{ esxi_hosts }}"
      register: dns

    - include_tasks: dhcp.yml
      when: dns['results'][0]['hosts_dns_info'][esxi1]['dhcp']
    - include_tasks: static.yml
      when: not dns['results'][0]['hosts_dns_info'][esxi1]['dhcp']