From b9728196781edf4d94944ce8ceb61fe15768c879 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Thu, 23 Dec 2021 12:01:28 +0100 Subject: [PATCH] Switched to yml vars files --- ansible/ansible.cfg | 3 +++ ansible/group_vars/all.yml | 18 ++++++++++++++++++ .../templates/portainer-stack.yml.j2 | 6 +++--- .../templates/traefik-stack.yml.j2 | 2 +- .../traefik-deploy/templates/traefik.yml.j2 | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 ansible/ansible.cfg create mode 100644 ansible/group_vars/all.yml diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..ab0b8df --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +vault_password_file = .ansible-password +inventory = rb.hosts.ini diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml new file mode 100644 index 0000000..06bb635 --- /dev/null +++ b/ansible/group_vars/all.yml @@ -0,0 +1,18 @@ +--- +ansible_ssh_user: debian +ansible_ssh_port: 2222 +ansible_become_pass: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 32636639346333343636656237353437333639376233613234663535306533306131323764633664 + 3735373364666336653137323233303135303961303462320a383635643865666330373438616535 + 65303939656336613730326363643133633834393066326163353038613230343039626666303261 + 3231376239656431300a383866636562613636383339396132316237323664383964383838653836 + 6432 + +portainer: + version: 2.11.0 + domain: dock.rustybever.be + +traefik: + version: 2.5.5 + acme_email: roosensjef@gmail.com diff --git a/ansible/roles/portainer-deploy/templates/portainer-stack.yml.j2 b/ansible/roles/portainer-deploy/templates/portainer-stack.yml.j2 index c357d3d..d2721a8 100644 --- a/ansible/roles/portainer-deploy/templates/portainer-stack.yml.j2 +++ b/ansible/roles/portainer-deploy/templates/portainer-stack.yml.j2 @@ -3,7 +3,7 @@ version: '3.2' services: app: - image: 'portainer/portainer-ce:{{ portainer_version }}-alpine' + image: 'portainer/portainer-ce:{{ portainer.version }}-alpine' command: '-H tcp://tasks.agent:9001 --tlsskipverify' deploy: @@ -14,7 +14,7 @@ services: - node.role == manager labels: - 'traefik.enable=true' - - 'traefik.http.routers.portainer.rule=Host(`{{ portainer_domain }}`)' + - 'traefik.http.routers.portainer.rule=Host(`{{ portainer.domain }}`)' - 'traefik.http.routers.portainer.service=portainer' - 'traefik.http.services.portainer.loadbalancer.server.port=9000' - 'traefik.http.routers.portainer.tls=true' @@ -30,7 +30,7 @@ services: - '8000:8000' agent: - image: 'portainer/agent:{{ portainer_version }}-alpine' + image: 'portainer/agent:{{ portainer.version }}-alpine' deploy: mode: global diff --git a/ansible/roles/traefik-deploy/templates/traefik-stack.yml.j2 b/ansible/roles/traefik-deploy/templates/traefik-stack.yml.j2 index b7bb042..ec8c879 100644 --- a/ansible/roles/traefik-deploy/templates/traefik-stack.yml.j2 +++ b/ansible/roles/traefik-deploy/templates/traefik-stack.yml.j2 @@ -3,7 +3,7 @@ version: '3' services: app: - image: 'traefik:{{ traefik_version }}' + image: 'traefik:{{ traefik.version }}' deploy: mode: replicated diff --git a/ansible/roles/traefik-deploy/templates/traefik.yml.j2 b/ansible/roles/traefik-deploy/templates/traefik.yml.j2 index 5154433..93c632c 100644 --- a/ansible/roles/traefik-deploy/templates/traefik.yml.j2 +++ b/ansible/roles/traefik-deploy/templates/traefik.yml.j2 @@ -19,7 +19,7 @@ providers: certificatesResolvers: letsEncrypt: acme: - email: "{{ letsencrypt_email }}" + email: "{{ traefik.acme_email }}" storage: "/etc/traefik/acme/acme.json" httpChallenge: entryPoint: web