Add or remove without error

This commit is contained in:
Adrien Reslinger 2020-05-19 00:27:42 +02:00
parent b285f2f842
commit a0f6cb9c66

View file

@ -1,7 +1,7 @@
#- debug: var=my_context #- debug: var=my_context
# tags: traefik # tags: monitoring
- name: traefik setup - name: monitoring setup
block: block:
- include_vars: "{{ item }}" - include_vars: "{{ item }}"
with_items: with_items:
@ -42,24 +42,52 @@
# - basic_auth == true # - basic_auth == true
# tags: prom # tags: prom
- name: Prometheus files need to be {{ prometheus_state }} - name: Install Prometheus files
k8s: k8s:
state: "{{ prometheus_state }}" state: "present"
context: "{{ my_context }}" context: "{{ my_context }}"
merge_type: merge merge_type: merge
resource_definition: "{{ lookup('template', item) | from_yaml }}" resource_definition: "{{ lookup('template', item) | from_yaml }}"
with_items: with_items:
- "{{ prometheus_files }}" - "{{ prometheus_files }}"
when:
- prometheus_state == "present"
tags: prometheus tags: prometheus
- name: Grafana files need to be {{ grafana_state }} - name: UnInstall Prometheus files
k8s: k8s:
state: "{{ grafana_state }}" state: "absent"
context: "{{ my_context }}"
merge_type: merge
resource_definition: "{{ lookup('template', item) | from_yaml }}"
with_items:
- "{{ prometheus_files | reverse | list }}"
when:
- prometheus_state == "absent"
tags: prometheus
- name: Install Grafana files
k8s:
state: "present"
context: "{{ my_context }}" context: "{{ my_context }}"
merge_type: merge merge_type: merge
resource_definition: "{{ lookup('template', item) | from_yaml }}" resource_definition: "{{ lookup('template', item) | from_yaml }}"
with_items: with_items:
- "{{ grafana_files }}" - "{{ grafana_files }}"
when:
- grafana_state == "present"
tags: grafana
- name: UnInstall Grafana files
k8s:
state: "absent"
context: "{{ my_context }}"
merge_type: merge
resource_definition: "{{ lookup('template', item) | from_yaml }}"
with_items:
- "{{ grafana_files | reverse | list }}"
when:
- grafana_state == "absent"
tags: grafana tags: grafana
- name: namespace - name: namespace