ansible-role-k8s-weave/tasks/main.yml
Adrien Reslinger e10bb28442
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Fix lint errors
2022-07-23 01:24:37 +02:00

99 lines
2.8 KiB
YAML

---
- name: Weave Net setup
block:
- name: Include Weave Net vars
ansible.builtin.include_vars: net-files.yaml
- name: Weave Net files
kubernetes.core.k8s:
state: present
context: "{{ my_context }}"
merge_type: merge
resource_definition: "{{ lookup('file', item) | from_yaml }}"
with_items:
- "{{ weave_net_files }}"
- name: Weave Net password
kubernetes.core.k8s:
state: present
context: "{{ my_context }}"
merge_type: merge
resource_definition: "{{ lookup('template', item) | from_yaml }}"
with_items:
- weave-net-secret.yml.j2
when:
- kubernetes_network == "weave-net"
tags:
- weave
- weave-net
- k8s-network
- name: Weave Scope setup
block:
- name: namespace
kubernetes.core.k8s:
context: "{{ my_context }}"
state: present
name: weave
api_version: v1
kind: Namespace
- name: Create a Secret object for basic authentification (traefik 1.7)
kubernetes.core.k8s:
state: present
context: "{{ my_context }}"
definition:
apiVersion: v1
kind: Secret
metadata:
name: basic-auth
namespace: weave
type: Opaque
data:
basic_auth: "{{ basic_auth_data | b64encode }}"
when:
- basic_auth|bool
- traefik_version is not defined or traefik_version | regex_search('(^1.)')
- name: Remove a Secret object for basic authentification (traefik 1.7)
kubernetes.core.k8s:
state: absent
context: "{{ my_context }}"
definition:
apiVersion: v1
kind: Secret
metadata:
name: basic-auth
namespace: weave
type: Opaque
data:
basic_auth: "{{ basic_auth_data | b64encode }}"
when:
- traefik_version is defined
- traefik_version | regex_search('(^2.)')
- name: Remove old existing Ingress object
kubernetes.core.k8s:
context: "{{ my_context }}"
state: absent
api_version: extensions/v1beta1
kind: Ingress
namespace: weave
name: weave
when:
- traefik_version is defined
- traefik_version | regex_search('(^2.)')
# file found https://github.com/weaveworks/scope/tree/master/examples/k8s/
- name: Weave Scope files
kubernetes.core.k8s:
state: "present"
context: "{{ my_context }}"
namespace: 'weave'
merge_type: merge
definition: "{{ item }}"
with_items: "{{ lookup('url', 'https://cloud.weave.works/k8s/' + weave_scope_version + '/scope.yaml', split_lines=False) | from_yaml_all | list }}"
when:
- weave_scope|bool
- item is not none
tags:
- weave
- weave-scope