-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-docker-project.yml
59 lines (52 loc) · 1.36 KB
/
03-docker-project.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
- name: Deploy Docker Compose
hosts: local
tasks:
- name: Install Docker Python module
become: true
ansible.builtin.pip:
name:
- docker
- docker-compose
state: present
- name: Deploy Docker images fetcher
community.docker.docker_compose:
project_name: linux_isos
definition: "{{ docker_project_docker_compose_yaml }}"
- name: Install nginx
become: true
ansible.builtin.apt:
name: nginx
state: present
- name: Remove default nginx site
become: true
ansible.builtin.file:
path: /etc/nginx/sites-enabled/default
state: absent
- name: Configure nginx
become: true
ansible.builtin.template:
src: nginx-site.j2
dest: "/etc/nginx/sites-available/{{ item.name }}"
owner: root
group: root
mode: "0644"
loop: "{{ nginx_hosts }}"
notify:
- Restart nginx
- name: Enable nginx site
become: true
ansible.builtin.file:
src: "/etc/nginx/sites-available/{{ item.name }}"
dest: "/etc/nginx/sites-enabled/{{ item.name }}"
state: link
loop: "{{ nginx_hosts }}"
notify:
- Restart nginx
handlers:
- name: Restart nginx
become: true
ansible.builtin.service:
name: nginx
state: restarted
...