Created
June 22, 2021 13:18
-
-
Save socketwench/80e79d68f2970d51de0388d889726050 to your computer and use it in GitHub Desktop.
Flight Deck Cluster ingress with HTTPAuth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: stage | |
vars: | |
flightdeck_cluster: | |
namespace: "example-com" | |
secrets: | |
- name: "ingress-auth" | |
data: | |
- name: "auth" | |
value: "{{ lookup('file', _run_temp_dir.path + '/.htpasswd' )}}" | |
ingress: | |
name: "ingress" | |
auth: | |
secret: "ingress-auth" | |
rules: | |
- host: "example.com" | |
paths: | |
- path: "/" | |
backend: "web" | |
port: "6081" | |
tasks: | |
- name: Create a temp directory to store files needed by the run | |
tempfile: | |
state: directory | |
prefix: "ansible-deploy-{{ cluster_name }}" | |
register: _run_temp_dir | |
notify: | |
- delete temp items | |
- name: Get the kubeconfig file. | |
import_role: | |
name: ten7.digitalocean_kubeconfig | |
vars: | |
digitalocean_kubeconfig: | |
cluster: "{{ cluster_name }}" | |
kubeconfig: "{{ _run_temp_dir.path }}/kubectl.yaml" | |
- name: Generate an .htpasswd to file as Ansible can't do this to a var | |
htpasswd: | |
path: "{{ _run_temp_dir.path }}/.htpasswd" | |
state: present | |
name: "{{ item.user }}" | |
password: "{{ item.pass }}" | |
loop: | |
- user: "myusername" | |
pass: "mypassword" | |
- name: Deploy the cluster definitions | |
include_role: | |
name: "ten7.flightdeck_cluster" | |
vars: | |
flightdeck_cluster_kubeconfig: "{{ _run_temp_dir.path }}/kubectl.yaml" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment