diff --git a/meta/main.yml b/meta/main.yml index 9bfe087..d80bde3 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -6,6 +6,6 @@ galaxy_info: galaxy_tags: [] license: GPL2 platforms: - - name: kubernetes - version: - - all + - name: kubernetes + version: + - all diff --git a/tasks/main.yml b/tasks/main.yml index 4a9a12d..0d84171 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,103 +3,103 @@ - name: monitoring setup block: - - name: Include vars files list - include_vars: "{{ item }}" - with_items: - - "prometheus_files_list.yml" - - "grafana_files_list.yml" + - name: Include vars files list + ansible.builtin.include_vars: "{{ item }}" + with_items: + - "prometheus_files_list.yml" + - "grafana_files_list.yml" - - name: Find state of monitoring stack - set_fact: - monitoring_state: absent - when: - - prometheus_state == "absent" - - grafana_state == "absent" + - name: Find state of monitoring stack + ansible.builtin.set_fact: + monitoring_state: absent + when: + - prometheus_state == "absent" + - grafana_state == "absent" - - name: namespace - k8s: - state: "{{ monitoring_state }}" - context: "{{ my_context }}" - name: "{{ monitoring_namespace }}" - api_version: v1 - kind: Namespace - when: - - monitoring_state == "present" + - name: namespace + kubernetes.core.k8s: + state: "{{ monitoring_state }}" + context: "{{ my_context }}" + name: "{{ monitoring_namespace }}" + api_version: v1 + kind: Namespace + when: + - monitoring_state == "present" -# - name: Create a Secret object for basic authentification -# k8s: -# state: "{{ prometheus_state }}" -# context: "{{ my_context }}" -# definition: -# apiVersion: v1 -# kind: Secret -# metadata: -# name: basic-auth -# namespace: "{{ monitoring_namespace }}" -# type: Opaque -# data: -# basic_auth: "{{ basic_auth_data | b64encode }}" -# when: -# - basic_auth == true -# tags: prom +# - name: Create a Secret object for basic authentification +# kubernetes.core.k8s: +# state: "{{ prometheus_state }}" +# context: "{{ my_context }}" +# definition: +# apiVersion: v1 +# kind: Secret +# metadata: +# name: basic-auth +# namespace: "{{ monitoring_namespace }}" +# type: Opaque +# data: +# basic_auth: "{{ basic_auth_data | b64encode }}" +# when: +# - basic_auth == true +# tags: prom - - name: Install Prometheus files - k8s: - state: "present" - context: "{{ my_context }}" - merge_type: merge - resource_definition: "{{ lookup('template', item) | from_yaml }}" - with_items: - - "{{ prometheus_files }}" - when: - - prometheus_state == "present" - tags: prometheus + - name: Install Prometheus files + kubernetes.core.k8s: + state: "present" + context: "{{ my_context }}" + merge_type: merge + resource_definition: "{{ lookup('template', item) | from_yaml }}" + with_items: + - "{{ prometheus_files }}" + when: + - prometheus_state == "present" + tags: prometheus - - name: UnInstall Prometheus files - k8s: - 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: UnInstall Prometheus files + kubernetes.core.k8s: + 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 }}" - merge_type: merge - resource_definition: "{{ lookup('template', item) | from_yaml }}" - with_items: - - "{{ grafana_files }}" - when: - - grafana_state == "present" - tags: grafana + - name: Install Grafana files + kubernetes.core.k8s: + state: "present" + context: "{{ my_context }}" + merge_type: merge + resource_definition: "{{ lookup('template', item) | from_yaml }}" + with_items: + - "{{ 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 + - name: UnInstall Grafana files + kubernetes.core.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 - - name: namespace - k8s: - state: "{{ monitoring_state }}" - context: "{{ my_context }}" - name: "{{ monitoring_namespace }}" - api_version: v1 - kind: Namespace - when: - - monitoring_state == "absent" + - name: namespace + kubernetes.core.k8s: + state: "{{ monitoring_state }}" + context: "{{ my_context }}" + name: "{{ monitoring_namespace }}" + api_version: v1 + kind: Namespace + when: + - monitoring_state == "absent" tags: - - monitoring \ No newline at end of file + - monitoring