-
Notifications
You must be signed in to change notification settings - Fork 4
/
install_vcsa.yml
88 lines (80 loc) · 2.58 KB
/
install_vcsa.yml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
- hosts: localhost
collections:
- community.vmware
vars:
vcenter_validate_certs: False
gather_facts: False
vcsa_ip: '192.168.123.90'
datastore_name: local
tasks:
- wait_for:
host: '{{ hostvars["esxi-vcenter"].ansible_host }}'
port: 443
- name: "wait for the ESXi"
uri:
url: 'https://{{ hostvars["esxi-vcenter"].ansible_host }}/ui/'
status_code: 200
validate_certs: false
register: result
until: result.status == 200
retries: 60
delay: 1
- name: add the host in /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: '.*vcenter.test.*'
line: "192.168.123.90 vcenter.test vcenter"
state: present
become: true
- name: add gateway.test (192.168.123.1) in too /etc/hosts
lineinfile:
dest: /etc/hosts
regexp: '^192.168.123.1 gateway.test gateway\s.*'
line: "192.168.123.1 gateway.test gateway"
state: present
become: yes
- name: Reload the dnsmasq instances
command: sudo pkill -HUP dnsmasq
become: true
- name: Ensure we can resolve the vcsa host
command: host vcenter 192.168.123.1
- name: Ensure we can resolve the vcsa FQDN
command: host vcenter.test 192.168.123.1
- name: Validate the reverse DNS resolution of the vcsa IP
shell: "nslookup vcenter.test 192.168.123.1|grep vcenter"
- name: Add Management Network VM Portgroup
vmware_portgroup:
hostname: '{{ hostvars["esxi-vcenter"].ansible_host }}'
username: root
password: '!234AaAa56'
esxi_hostname: 'esxi-vcenter'
switch: "vSwitch0"
portgroup: "VM Network"
validate_certs: no
- import_role:
name: goneri.vcenter-instance
vars:
vcenter_instance_installation_from: 'iso'
vcenter_instance_network_address: '{{ vcsa_ip }}'
vcenter_instance_network_prefix: 24
vcenter_instance_network_gateway: 192.168.123.1
vcenter_instance_network_dns: 192.168.123.1
vcenter_instance_network_hostname: vcenter.test
vcenter_instance_esxi_hostname: '{{ hostvars["esxi-vcenter"].ansible_host }}'
vcenter_instance_esxi_username: root
vcenter_instance_esxi_password: '!234AaAa56'
- name: clean up the host in /etc/hosts
lineinfile:
dest: /etc/hosts
line: "192.168.123.90 vcenter.test vcenter"
state: absent
become: true
- name: add gateway.test (192.168.123.1) in too /etc/hosts
lineinfile:
dest: /etc/hosts
line: "192.168.123.1 gateway.test gateway"
state: absent
become: yes
- name: Reload the dnsmasq instances
command: sudo pkill -HUP dnsmasq
become: true