-
Notifications
You must be signed in to change notification settings - Fork 15
/
kube.deployment.playbook.yml
41 lines (32 loc) · 1.07 KB
/
kube.deployment.playbook.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
- hosts:
- localhost
vars_files:
- ./kube-vars.yml
tasks:
- include_vars: "vars/{{ ansible_os_family }}.yml"
- fail:
msg: "Please specify an app name and all relevant info in kube-vars.yml to use this"
when: "app.name == '<app_name>'"
- name: ensure manifest dir exists
file:
path: "{{manifest_app_dir}}"
state: directory
- name: kubectl get secrets
shell: kubectl get secrets
register: kube_secrets
- name: create manifest template for kube deploy
template:
src: "{{deployment_file}}"
dest: "{{manifest_app_dir}}/{{deployment_file}}"
register: deploy_template
# Applys
- block:
- name: apply kubernetes deployment
shell: "kubectl apply -f {{manifest_app_dir}}/{{deployment_file}}"
when: "deployment_enabled"
# Removals
- block:
- name: remove kubernetes deployment
shell: "kubectl delete -f {{manifest_app_dir}}/{{deployment_file}}"
register: remove_kube_deployment
when: not deployment_enabled