diff --git a/ansible/playbooks/authentik.yaml b/ansible/playbooks/authentik.yaml new file mode 100644 index 0000000..150e05b --- /dev/null +++ b/ansible/playbooks/authentik.yaml @@ -0,0 +1,10 @@ +--- +- name: Install / remove authentik + hosts: authentik + become: true + debugger: on_failed + roles: + - geerlingguy.docker + - newt_client + - ax-bzh.authentik + diff --git a/ansible/playbooks/roles/newt_client/defaults/main.yaml b/ansible/playbooks/roles/newt_client/defaults/main.yaml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/ansible/playbooks/roles/newt_client/defaults/main.yaml @@ -0,0 +1 @@ +--- diff --git a/ansible/playbooks/roles/newt_client/tasks/docker_newt.yaml b/ansible/playbooks/roles/newt_client/tasks/docker_newt.yaml new file mode 100644 index 0000000..eeece4c --- /dev/null +++ b/ansible/playbooks/roles/newt_client/tasks/docker_newt.yaml @@ -0,0 +1,31 @@ +--- +- name: Create docker compose directory + ansible.builtin.file: + path: "/home/{{ ansible_user }}/compose_projects/newt_compose" + state: directory + mode: '0755' + register: compose_dir + +- name: Copy compose file + ansible.builtin.template: + src: templates/newt_compose.yaml.j2 + dest: "{{ compose_dir.path }}/compose.yaml" + + +- name: Copy secret file + ansible.builtin.template: + src: templates/newt-config.secret.j2 + dest: "{{ compose_dir.path }}/newt-config.secret" + + + +- name: Defining network + community.docker.docker_network: + name: "newt-network" + state: present + + + +- name: Starting newt project + community.docker.docker_compose_v2: + project_src: "{{ compose_dir.path }}" diff --git a/ansible/playbooks/roles/newt_client/tasks/main.yaml b/ansible/playbooks/roles/newt_client/tasks/main.yaml new file mode 100644 index 0000000..1e18ee5 --- /dev/null +++ b/ansible/playbooks/roles/newt_client/tasks/main.yaml @@ -0,0 +1,2 @@ +--- +- include_tasks: docker_newt.yaml diff --git a/ansible/playbooks/roles/newt_client/templates/newt-config.secret.j2 b/ansible/playbooks/roles/newt_client/templates/newt-config.secret.j2 new file mode 100644 index 0000000..f6fb0ff --- /dev/null +++ b/ansible/playbooks/roles/newt_client/templates/newt-config.secret.j2 @@ -0,0 +1,6 @@ +{ + "id": "{{ pangolin_site_id }}", + "secret": "{{ newt_secret }}", + "endpoint": "https://pangolin.{{ base_domain }}", + "tlsClientCert": "" +} \ No newline at end of file diff --git a/ansible/playbooks/roles/newt_client/templates/newt_compose.yaml.j2 b/ansible/playbooks/roles/newt_client/templates/newt_compose.yaml.j2 new file mode 100644 index 0000000..a607f9c --- /dev/null +++ b/ansible/playbooks/roles/newt_client/templates/newt_compose.yaml.j2 @@ -0,0 +1,23 @@ +services: + + newt: + image: fosrl/newt + container_name: newt + restart: unless-stopped + environment: + - CONFIG_FILE=/run/secrets/newt-config + secrets: + - newt-config + + networks: + - newt-network + + + +networks: + newt-network: + external: true + +secrets: + newt-config: + file: ./newt-config.secret \ No newline at end of file