First commit
This commit is contained in:
parent
dabdda6a9c
commit
9fa90d889e
20 changed files with 508 additions and 0 deletions
49
tasks/main.yml
Normal file
49
tasks/main.yml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#- debug: var=my_context
|
||||
# tags: traefik
|
||||
|
||||
- name: traefik setup
|
||||
block:
|
||||
- name: namespace
|
||||
k8s:
|
||||
state: present
|
||||
context: "{{ my_context }}"
|
||||
name: tools
|
||||
api_version: v1
|
||||
kind: Namespace
|
||||
|
||||
- name: Create a Secret object for basic authentification
|
||||
k8s:
|
||||
state: present
|
||||
context: "{{ my_context }}"
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: basic-auth
|
||||
namespace: tools
|
||||
type: Opaque
|
||||
data:
|
||||
basic_auth: "{{ basic_auth_data | b64encode }}"
|
||||
when:
|
||||
- basic_auth == true
|
||||
tags: traefik
|
||||
|
||||
- name: Get Deployment information object
|
||||
k8s_facts:
|
||||
context: "{{ my_context }}"
|
||||
api_version: v1
|
||||
kind: Deployment
|
||||
name: traefik
|
||||
namespace: tools
|
||||
field_selectors:
|
||||
- spec.template.spec.containers.image
|
||||
register: traefik_actual_resources
|
||||
|
||||
- name: Retreive actual traefik version
|
||||
shell: echo "{{ traefik_actual_resources.resources }}" | sed "s/.*traefik:v\([.0-9]*\).*/\1/" | uniq
|
||||
register: traefik_actual_version
|
||||
|
||||
- name: install / uninstall version 2.0
|
||||
include_tasks: "version_2.0.yml"
|
||||
when:
|
||||
- traefik_version == 2.0 or traefik_actual_version.stdout == 2.0
|
||||
33
tasks/version_2.0.yml
Normal file
33
tasks/version_2.0.yml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
- set_fact:
|
||||
traefik_2_0_state: "present"
|
||||
when:
|
||||
- traefik_version == "2.0"
|
||||
|
||||
- set_fact:
|
||||
traefik_2_0_state: "absent"
|
||||
when:
|
||||
- traefik_version != "2.0"
|
||||
|
||||
- name: traefik files
|
||||
k8s:
|
||||
state: "{{ traefik_2_0_state }}"
|
||||
context: "{{ my_context }}"
|
||||
resource_definition: "{{ lookup('template', item) | from_yaml }}"
|
||||
with_items:
|
||||
- 2.0/traefik-cm.yml.j2
|
||||
- 2.0/traefik-sa.yml.j2
|
||||
- 2.0/traefik-clusterrole.yml.j2
|
||||
- 2.0/traefik-clusterrolebinding.yml.j2
|
||||
- 2.0/traefik-crd-ingressroute.yml.j2
|
||||
- 2.0/traefik-crd-ingressroutetcp.yml.j2
|
||||
- 2.0/traefik-crd-middleware.yml.j2
|
||||
- 2.0/traefik-crd-tlsoption.yml.j2
|
||||
- 2.0/traefik-middleware-httpsredirect.yml.j2
|
||||
- 2.0/traefik-middleware-basicauth.yml.j2
|
||||
- 2.0/traefik-dp.yml.j2
|
||||
- 2.0/traefik-svc.yml.j2
|
||||
- 2.0/traefik-dashboard-svc.yml.j2
|
||||
- 2.0/traefik-dashboard.yml.j2
|
||||
- 2.0/traefik-dashboard-insecure.yml.j2
|
||||
tags: traefik
|
||||
Loading…
Add table
Add a link
Reference in a new issue