]> git.somenet.org - root/pub/somesible.git/blob - roles/server/docker-compose/tasks/main.yml
roles/service/mattermost/defaults
[root/pub/somesible.git] / roles / server / docker-compose / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: install docker and docker-compose
9   apt:
10     pkg:
11     - docker.io
12     - docker-compose
13     state: present
14     policy_rc_d: 101
15   tags: "online"
16   ignore_errors: "{{ignore_online_errors | bool}}"
17
18
19 - name: copy daemon.json to /etc/docker/daemon.json
20   copy:
21     src: "{{item}}"
22     dest: "/etc/docker/daemon.json"
23     mode: 0644
24     owner: "root"
25     group: "root"
26   with_first_found:
27     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/daemon.json"
28     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/daemon.json"
29     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/daemon.json"
30     - "default/daemon.json"
31   notify: restart docker.service
32
33
34 - name: copy docker-compose.target to /etc/systemd/system/
35   copy:
36     src: "{{item}}"
37     dest: "/etc/systemd/system/docker-compose.target"
38     mode: 0644
39     owner: "root"
40     group: "root"
41   with_first_found:
42     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/docker-compose.target"
43     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/docker-compose.target"
44     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/docker-compose.target"
45     - "default/docker-compose.target"
46   notify: restart docker-compose.target
47
48
49 - name: copy docker-compose@.service to /etc/systemd/system/
50   copy:
51     src: "{{item}}"
52     dest: "/etc/systemd/system/docker-compose@.service"
53     mode: 0644
54     owner: "root"
55     group: "root"
56   with_first_found:
57     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/docker-compose@.service"
58     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/docker-compose@.service"
59     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/docker-compose@.service"
60     - "default/docker-compose@.service"
61   notify: restart docker-compose.target
62
63
64 - name: enable and start docker.service
65   include_role: name="base/systemd/enable-and-start"
66   vars:
67     service_name: docker.service