-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure_nsx_vmks.yml
63 lines (59 loc) · 2.62 KB
/
configure_nsx_vmks.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
---
- hosts: localhost
connection: local
gather_facts: False
vars_files:
- ./answerfile.yml
tasks:
- name: NSX-T VLAN Logical Switch 1
nsxt_logical_switch:
display_name: "mgmt-vlan-{{ hostvars['localhost'].vlan_ls_mgmt }}"
description: "Management VLAN Logical Switch"
transport_zone_id: "{{ vlan_tzone.id }}"
vlan: "{{ hostvars['localhost'].vlan_ls_mgmt }}"
tags:
ncp/cluster: "{{ hostvars['localhost'].tag }}"
state: present
nsx_manager: "{{ hostvars['nsx-manager'].ansible_ssh_host }}"
nsx_username: 'admin'
nsx_passwd: "{{ hostvars['nsx-manager'].ansible_ssh_pass }}"
when: hostvars['localhost'].vlan_ls_mgmt is defined
register: ls1
- name: NSX-T VLAN Logical Switch 2
nsxt_logical_switch:
display_name: "vMotion-vlan-{{ hostvars['localhost'].vlan_ls_vmotion }}"
description: "vMotion VLAN Logical Switch"
transport_zone_id: "{{ vlan_tzone.id }}"
vlan: "{{ hostvars['localhost'].vlan_ls_vmotion }}"
tags:
ncp/cluster: "{{ hostvars['localhost'].tag }}"
state: present
nsx_manager: "{{ hostvars['nsx-manager'].ansible_ssh_host }}"
nsx_username: 'admin'
nsx_passwd: "{{ hostvars['nsx-manager'].ansible_ssh_pass }}"
when: hostvars['localhost'].vlan_ls_vmotion is defined
register: ls2
- name: NSX-T VLAN Logical Switch 3
nsxt_logical_switch:
display_name: "vSan-vlan-{{ hostvars['localhost'].vlan_ls_vsan }}"
description: "vSANt VLAN Logical Switch"
transport_zone_id: "{{ vlan_tzone.id }}"
vlan: "{{ hostvars['localhost'].vlan_ls_mgmt }}"
tags:
ncp/cluster: "{{ hostvars['localhost'].tag }}"
state: present
nsx_manager: "{{ hostvars['nsx-manager'].ansible_ssh_host }}"
nsx_username: 'admin'
nsx_passwd: "{{ hostvars['nsx-manager'].ansible_ssh_pass }}"
when: hostvars['localhost'].vlan_ls_vsan is defined
register: ls3
# - name: Remove previous SSH keys from known_hosts - NSX nodes
# command: ssh-keygen -R "{{ hostvars[item]['ansible_ssh_host'] }}"
# register: command_result
# failed_when: "command_result.rc > 0 and command_result.rc != 255"
# with_items: "{{ groups['nsxtransportnodes'] }}"
# when: groups['nsxtransportnodes'] is defined
# - name: add host to known_hosts - Managers
# shell: mkdir -p ~/.ssh; ssh-keyscan -H "{{ hostvars[item]['ansible_ssh_host'] }}" >> ~/.ssh/known_hosts
# with_items: "{{ groups['nsxtransportnodes'] }}"
# when: groups['nsxtransportnodes'] is defined