Add ssl_certs_enabled variable and use it to avoid ssl certs when running on vagrant

This commit is contained in:
Víðir Valberg Guðmundsson 2022-11-15 23:05:52 +01:00
parent 42ebebc3f5
commit 5d0c913c2a
5 changed files with 8 additions and 9 deletions

View file

@ -1,12 +1,15 @@
--- ---
- hosts: all - hosts: all
gather_facts: false gather_facts: true
become: true become: true
vars: vars:
base_domain: data.coop base_domain: data.coop
letsencrypt_email: admin@data.coop letsencrypt_email: admin@data.coop
ldap_dn: "dc=data,dc=coop" ldap_dn: "dc=data,dc=coop"
vagrant: "{{ ansible_virtualization_role == 'guest' }}"
ssl_certs_enabled: "{{ vagrant == false }}"
services: services:
- nginx-proxy - nginx-proxy
- postfix - postfix

View file

@ -28,7 +28,7 @@
dest: "{{ mailu.volume_folder }}/certs/cert.pem" dest: "{{ mailu.volume_folder }}/certs/cert.pem"
state: hard state: hard
force: yes force: yes
when: ssl_certs_enabled
- name: hard link to Let's Encrypt TLS key - name: hard link to Let's Encrypt TLS key
file: file:
@ -36,6 +36,7 @@
dest: "{{ mailu.volume_folder }}/certs/key.pem" dest: "{{ mailu.volume_folder }}/certs/key.pem"
state: hard state: hard
force: yes force: yes
when: ssl_certs_enabled
- name: run mail server containers - name: run mail server containers
docker_compose: docker_compose:

View file

@ -44,4 +44,5 @@
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
env: env:
NGINX_PROXY_CONTAINER: nginx-proxy NGINX_PROXY_CONTAINER: nginx-proxy
when: ssl_certs_enabled

View file

@ -1,11 +1,9 @@
--- ---
- import_tasks: ssh-port.yml - import_tasks: ssh-port.yml
tags: [change-ssh-port] tags: [change-ssh-port]
- import_tasks: virtualization.yml
tags: [gather-virtualization-facts]
- import_tasks: dell-apt-repo.yml - import_tasks: dell-apt-repo.yml
tags: [setup-dell-apt-repo] tags: [setup-dell-apt-repo]
when: ansible_virtualization_role != "guest" when: vagrant == false
- import_tasks: upgrade.yml - import_tasks: upgrade.yml
tags: [do-full-system-upgrade] tags: [do-full-system-upgrade]
- import_tasks: base.yml - import_tasks: base.yml

View file

@ -1,4 +0,0 @@
---
- name: Determine if running in a VM
setup:
gather_subset: virtualization_role