-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcreate_namespace.yml
More file actions
33 lines (28 loc) · 985 Bytes
/
create_namespace.yml
File metadata and controls
33 lines (28 loc) · 985 Bytes
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
---
# This playbook creates a K8S namespace for a particular
# customer/environment
- name: Create the namespace
hosts: local
gather_facts: false
pre_tasks:
- name: Check configuration
ansible.builtin.import_tasks: tasks/check_configuration.yml
tasks:
- name: Display playbook name
ansible.builtin.debug: msg="==== Starting create_namespace playbook ===="
tags: deploy
- name: Set vars
ansible.builtin.import_tasks: tasks/set_vars.yml
- name: Make sure the namespace exists in K8S and is up-to-date
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Namespace
metadata:
name: "{{ namespace_name }}"
labels: "{{ k8s_namespace_labels | default({}) | combine({'name': namespace_name}) }}"
register: new_namespace
until: new_namespace.result is defined and new_namespace.result.status is success
retries: 30
delay: 10