-
Notifications
You must be signed in to change notification settings - Fork 5
/
230-ushift-app-deployment.yaml
67 lines (60 loc) · 1.88 KB
/
230-ushift-app-deployment.yaml
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
---
# This playbook deployes applications to ushift
#
- hosts: "cluster_{{ ushift_env }}"
gather_facts: false
tasks:
- name: Firewall open API port for external access
tags: prep, firewall
firewalld:
immediate: yes
permanent: yes
port: 6443/tcp
state: enabled
- name: Copy kubeconfig to root user on VM
tags: post, kubecfg
copy:
src: /var/lib/microshift/resources/kubeadmin/{{inventory_hostname}}.{{ sysctx_dns_domain }}/kubeconfig
remote_src: true
dest: /root/.kube/config
mode: 600
- name: Slurp kubeconfig
tags: post, kubecfg, acm
ansible.builtin.slurp:
src: "/root/.kube/config"
register: slurp_kubeconfig
- name: Set kubeconfig
tags: post, kubecfg, acm
set_fact:
ushift_kubeconfig: "{{ slurp_kubeconfig['content'] | b64decode }}"
- name: Create temporary local kubeconfig file
tags: post, kubecfg
changed_when: false
local_action:
module: ansible.builtin.tempfile
state: file
suffix: temp
register: temp_kubeconfig
- name: Fetch kubeconfig from remote
tags: post, kubecfg
changed_when: false
fetch:
src: /root/.kube/config
dest: "{{temp_kubeconfig.path}}"
flat: true
- name: Deploy sample workload
local_action:
module: kubernetes.core.k8s
kubeconfig: "{{temp_kubeconfig.path}}"
validate_certs: false
state: present
apply: true
wait: false
definition: "{{ lookup('template', 'roles/ushift_rpm_on_kubevirt/templates/microshift-app-hello.yaml') }}"
- name: Remove temporary local kubeconfig file
when: temp_kubeconfig.path is defined
changed_when: false
local_action:
module: ansible.builtin.file
path: "{{ temp_kubeconfig.path }}"
state: absent