fix the docker role

This commit is contained in:
Andreas Zweili 2021-11-10 22:25:38 +01:00
parent 2cea7f21ca
commit 0004113253
5 changed files with 39 additions and 15 deletions

View File

@ -1 +0,0 @@
docker_skip_project: false

11
docker-server.yml Normal file
View File

@ -0,0 +1,11 @@
---
- hosts: docker
become: true
roles:
- common
- common-server
- restic
tasks:
- import_tasks: tasks/main.yml
vars_files:
- vars/main.yml

7
requirements.yml Normal file
View File

@ -0,0 +1,7 @@
roles:
- src: https://git.2li.ch/ansible/common.git
scm: git
- src: https://git.2li.ch/ansible/common-server.git
scm: git
- src: https://git.2li.ch/ansible/restic.git
scm: git

View File

@ -32,19 +32,26 @@
- "LICENSE"
- "README.md"
- name: "Copy the project files to the server"
copy:
src: "{{ docker_project_name }}"
dest: "{{ lookup('env', 'HOME') }}/"
become: false
when: not docker_skip_project
- name: "Get the Systems repository"
ansible.builtin.git:
repo: "https://git.2li.ch/Nebucatnetzer/docker_systems.git"
dest: "{{ lookup('env', 'HOME') }}/docker_systems"
become: no
when: docker_skip_project is undefined
- name: "Copy the traefik config"
copy:
src: "traefik.yaml"
dest: "{{ docker_project_path }}/traefik.yaml"
become: false
when: not docker_skip_project
- name: "Get the .env template"
ansible.builtin.fetch:
src: "{{ docker_project_path }}/.env.example"
dest: "/tmp/.env.example"
become: no
when: docker_skip_project is undefined
- name: "Copy the .env file"
ansible.builtin.template:
src: "/tmp/.env.example"
dest: "{{ docker_project_path }}/.env"
become: no
when: docker_skip_project is undefined
- name: "Start the Docker containers"
community.docker.docker_compose:
@ -52,4 +59,4 @@
state: "present"
pull: "yes"
remove_orphans: "yes"
when: not docker_skip_project
when: docker_skip_project is undefined

View File

@ -1,2 +1,2 @@
docker_lazydocker_version: 0.12
docker_project_path: "{{ lookup('env', 'HOME') }}/{{ docker_project_name }}"
docker_project_path: "{{ lookup('env', 'HOME') }}/docker_systems/{{ docker_project_name }}"