-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path99_playbook_get_k8s_info.yml
35 lines (35 loc) · 1.15 KB
/
99_playbook_get_k8s_info.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
# This example Playbook adds a Kubernetes Cluster to PPDM
# Kubernetes Information will be read from k8s core cluster_info module
# it is expected that Environment Variables are set for core K8S Modules
# e.g. export K8S_AUTH_KUBECONFIG=
- name: Get K8S Info
hosts: localhost
gather_facts: no
connection: local
vars_files:
- ./vars/main.yml
tasks:
# - name: install pre-requisites
# pip:
# name:
# - openshift
# - pyyaml
# - kubernetes
- name: Checking Required Variable ppdm_fqdn
fail:
msg: "We do not have ppdm_fqdn set !"
when: (ppdm_fqdn is not defined) or (ppdm_fqdn|length <= 8)
- name: Checking Required Variables
fail:
msg: "We do not have ppdm_new_password set !"
when: (ppdm_new_password is not defined) or (ppdm_new_password|length == 0)
- name: Setting Base URL
ansible.builtin.set_fact:
ppdm_baseurl: "https://{{ ppdm_fqdn | regex_replace('^https://') }}"
- name: Get Cluster information
kubernetes.core.k8s_cluster_info:
verify_ssl: no
register: api_status
- debug:
msg: "Connected to {{ api_status.connection.host }}"
verbosity: 0