lab-ansible/roles/apps/tasks/main.yml

47 lines
1.2 KiB
YAML

# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create Docker network for apps
community.docker.docker_network:
name: "{{ apps_shared_docker_network }}"
enable_ipv6: true
ipam_config:
- subnet: 172.17.2.0/24
- subnet: fd02::/64
state: "{{ 'present' if 'caddy' in apps_include or 'nginx' in apps_include else 'absent' }}"
- name: Create Docker network for Postfix
community.docker.docker_network:
name: "{{ apps_postfix_docker_network }}"
state: present
when: "'postfix' in apps_include"
- name: Create Docker network for Tor
community.docker.docker_network:
name: "{{ apps_tor_docker_network }}"
state: present
when: "'tor' in apps_include"
- name: Create base directory for apps
ansible.builtin.file:
path: "{{ apps_data_root }}"
owner: root
group: root
mode: u=rwx,g=rx,o=rx
state: directory
- name: Configure apps
ansible.builtin.include_tasks:
file: app.yml
loop: "{{ apps_include }}"
loop_control:
loop_var: app
- name: Copy deploy.sh
ansible.builtin.template:
src: scripts/deploy.sh.j2
dest: /usr/bin/deploy.sh
owner: root
group: root
mode: u=rwx,g=rx,o=rx