forked from cptmorgan-rh/openshift4_vcenter_permissions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.yml
79 lines (71 loc) · 2.74 KB
/
main.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
---
- name: OpenShift permission helper playbook for vCenter
hosts: ocp1
gather_facts: False
vars_prompt:
- name: "vcenter_admin_username"
prompt: "Admin Username"
- name: "vcenter_admin_password"
prompt: "Admin Password"
private: yes # Masks input for sensitive data
tasks:
- ansible.builtin.debug:
msg: 'Logging in as {{ vcenter_admin_username }}'
- name: Flatten vCenter variables from ini file
set_fact:
vcenter:
ip: "{{ vcenter_ip }}"
admin_username: "{{ vcenter_admin_username }}"
admin_password: "{{ vcenter_admin_password }}"
datacenter: "{{ vcenter_datacenter }}"
cluster: "{{ vcenter_cluster }}"
datastore: "{{ vcenter_datastore }}"
network: "{{ vcenter_network }}"
dswitch: "{{ vcenter_dswitch }}"
folder: "{{ vcenter_folder }}"
create_folder: "{{ vcenter_create_folder }}"
role_prefix: "{{ vcenter_role_prefix }}"
no_log: true
- name: Flatten OpenShift variables from ini file
set_fact:
openshift:
vcenter_svc_account: "{{ openshift_vcenter_svc_account }}"
installer_created_folder: "{{ openshift_installer_created_folder }}"
no_log: true
- name: Print vCenter configuration
debug:
msg:
- "vCenter Configuration:"
- "IP: {{ vcenter.ip }}"
- "Datacenter: {{ vcenter.datacenter }}"
- "Cluster: {{ vcenter.cluster }}"
- "Datastore: {{ vcenter.datastore }}"
- "Network: {{ vcenter.network }}"
- "DSwitch: {{ vcenter.dswitch }}"
- "Folder: {{ vcenter.folder }}"
- "Create Folder: {{ vcenter.create_folder }}"
- "Role Prefix: {{ vcenter.role_prefix }}"
- name: Print OpenShift configuration
debug:
msg:
- "OpenShift Configuration:"
- "vCenter Service Account: {{ openshift.vcenter_svc_account }}"
- "Installer Created Folder: {{ openshift.installer_created_folder }}"
- name: Provide information about vCenter folders
community.vmware.vmware_folder_info:
hostname: '{{ vcenter.ip }}'
username: '{{ vcenter.admin_username }}'
password: '{{ vcenter.admin_password }}'
datacenter: '{{ vcenter.datacenter }}'
validate_certs: false
- name: Create OCP 4 vCenter Role
import_role:
name: create_ocp4_vcenter_roles
- name: Apply OCP 4 vCenter Role
import_role:
name: apply_roles_precreated_folder
when: openshift.installer_created_folder != True
- name: Apply OCP 4 vCenter Role
import_role:
name: apply_roles_installer_created_folder
when: openshift.installer_created_folder == True