aboutsummaryrefslogtreecommitdiff
path: root/roles/services/containers/drawio/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/services/containers/drawio/tasks')
-rw-r--r--roles/services/containers/drawio/tasks/main.yml149
1 files changed, 149 insertions, 0 deletions
diff --git a/roles/services/containers/drawio/tasks/main.yml b/roles/services/containers/drawio/tasks/main.yml
new file mode 100644
index 0000000..27bbefd
--- /dev/null
+++ b/roles/services/containers/drawio/tasks/main.yml
@@ -0,0 +1,149 @@
1- name: set image fact
2 set_fact:
3 image: jgraph/drawio:21.5.0
4
5- name: set other facts
6 vars:
7 array: "{{ image.split('/', 1) }}"
8 set_fact:
9 repo_tag: "{{ array.1 }}"
10 custom_registry: "{{ docker_registry_url + '/' + docker_registry_username }}"
11
12- name: create drawio directory
13 file:
14 path: "{{ docker_home }}/drawio"
15 state: directory
16 owner: "{{ docker_username }}"
17 group: "{{ docker_username }}"
18 mode: '0755'
19
20- name: create drawio fonts directory
21 file:
22 path: /usr/share/fonts/drawio
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: login to docker registry
29 become: yes
30 become_user: "{{ docker_username }}"
31 environment:
32 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
33 docker_login:
34 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
35 registry_url: "{{ docker_registry_url }}"
36 username: "{{ docker_registry_username }}"
37 password: "{{ docker_registry_password }}"
38
39- name: get drawio image
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
44 docker_image:
45 name: "{{ image }}"
46 repository: "{{ custom_registry }}/{{ repo_tag }}"
47 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
48 source: pull
49 force_source: yes
50 push: yes
51
52- name: get export-server image
53 become: yes
54 become_user: "{{ docker_username }}"
55 environment:
56 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
57 docker_image:
58 name: "{{ docker_registry_url }}/{{ docker_registry_username }}/image-export:latest"
59 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
60 source: pull
61 force_source: yes
62 push: yes
63
64- name: create drawio docker network
65 become: yes
66 become_user: "{{ docker_username }}"
67 docker_network:
68 name: "{{ drawio_network_name }}"
69 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
70 driver: bridge
71 ipam_config:
72 - subnet: "{{ drawio_subnet }}"
73 gateway: "{{ drawio_gateway }}"
74
75- name: create and deploy drawio export-server
76 become: yes
77 become_user: "{{ docker_username }}"
78 environment:
79 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
80 docker_container:
81 name: "image-export"
82 image: "{{ docker_registry_url }}/{{ docker_registry_username }}/image-export:latest"
83 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
84 pull: yes
85 exposed_ports:
86 - '8000'
87 purge_networks: yes
88 networks:
89 - name: "{{ drawio_network_name }}"
90 ipv4_address: "{{ drawio_export_ipv4 }}"
91 volumes:
92 - fonts_volume:/usr/share/fonts/drawio
93 env:
94 DRAWIO_BASE_URL: "{{ drawio_base_url }}"
95 cap_drop:
96 - all
97 hostname: "image-export"
98 restart_policy: unless-stopped
99 state: 'started'
100 recreate: yes
101
102- name: create and deploy drawio
103 become: yes
104 become_user: "{{ docker_username }}"
105 environment:
106 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
107 docker_container:
108 name: "drawio"
109 image: "{{ custom_registry }}/{{ repo_tag }}"
110 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
111 pull: yes
112 purge_networks: yes
113 networks:
114 - name: "{{ drawio_network_name }}"
115 ipv4_address: "{{ drawio_ipv4 }}"
116 ports:
117 - "127.0.0.1:8443:8443"
118 - "127.0.0.1:8400:8080"
119 links:
120 - image-export:image-export
121 env:
122 DRAWIO_SELF_CONTAINED: "1"
123 PLANTUML_URL: "http://plantuml-server:8080/"
124 EXPORT_URL: "http://image-export:8000/"
125 DRAWIO_PUSHER_MODE: "2"
126 cap_drop:
127 - all
128 hostname: "drawio"
129 restart_policy: unless-stopped
130 state: 'started'
131 recreate: yes
132
133- name: deploy nginx configuration
134 notify: restart nginx
135 register: nginx_config
136 copy:
137 src: "{{ drawio_nginx_config }}"
138 dest: /etc/nginx/sites-available/drawio.conf
139 owner: root
140 group: root
141 mode: '0644'
142
143- name: symlink site
144 file:
145 src: /etc/nginx/sites-available/drawio.conf
146 dest: /etc/nginx/sites-enabled/drawio.conf
147 owner: root
148 group: root
149 state: link