diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-25 09:52:36 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-25 09:52:36 -0400 |
commit | 95b73daa36b23565a8566f71f9b202d3459b685f (patch) | |
tree | cb17b021be70e7868d0ec235a761f0ecdc80f3f2 /roles/services/containers/kanboard |
Diffstat (limited to 'roles/services/containers/kanboard')
-rw-r--r-- | roles/services/containers/kanboard/handlers/main.yml | 18 | ||||
-rw-r--r-- | roles/services/containers/kanboard/tasks/main.yml | 93 |
2 files changed, 111 insertions, 0 deletions
diff --git a/roles/services/containers/kanboard/handlers/main.yml b/roles/services/containers/kanboard/handlers/main.yml new file mode 100644 index 0000000..de5dcb6 --- /dev/null +++ b/roles/services/containers/kanboard/handlers/main.yml | |||
@@ -0,0 +1,18 @@ | |||
1 | - name: build pywttr-docker image | ||
2 | become: yes | ||
3 | become_user: "{{ docker_username }}" | ||
4 | environment: | ||
5 | XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}" | ||
6 | docker_image: | ||
7 | name: "{{ docker_registry_url }}/{{ docker_registry_username }}/pywttr-docker:latest" | ||
8 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
9 | build: | ||
10 | path: /srv/docker/pywttr-docker/src | ||
11 | source: build | ||
12 | push: yes | ||
13 | force_source: yes | ||
14 | |||
15 | - name: restart nginx | ||
16 | service: | ||
17 | name: nginx | ||
18 | state: restarted | ||
diff --git a/roles/services/containers/kanboard/tasks/main.yml b/roles/services/containers/kanboard/tasks/main.yml new file mode 100644 index 0000000..1efc16e --- /dev/null +++ b/roles/services/containers/kanboard/tasks/main.yml | |||
@@ -0,0 +1,93 @@ | |||
1 | - name: set image fact | ||
2 | set_fact: | ||
3 | image: kanboard/kanboard:v1.2.30 | ||
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 kanboard directory | ||
13 | file: | ||
14 | path: "{{ docker_home }}/kanboard" | ||
15 | state: directory | ||
16 | owner: "{{ docker_username }}" | ||
17 | group: "{{ docker_username }}" | ||
18 | mode: '0755' | ||
19 | |||
20 | - name: create data directory | ||
21 | file: | ||
22 | path: "{{ docker_home }}/kanboard/data" | ||
23 | state: directory | ||
24 | owner: "{{ docker_username }}" | ||
25 | group: "{{ docker_username }}" | ||
26 | mode: '0755' | ||
27 | |||
28 | - name: deploy custom configuration | ||
29 | copy: | ||
30 | src: "{{ kanboard_config }}" | ||
31 | dest: "{{ docker_home }}/kanboard/data/config.php" | ||
32 | owner: "{{ docker_username }}" | ||
33 | group: "{{ docker_username }}" | ||
34 | mode: '0644' | ||
35 | |||
36 | - name: create plugins directory | ||
37 | file: | ||
38 | path: "{{ docker_home }}/kanboard/plugins" | ||
39 | state: directory | ||
40 | owner: "{{ docker_username }}" | ||
41 | group: "{{ docker_username }}" | ||
42 | mode: '0755' | ||
43 | |||
44 | - name: create kanboard network | ||
45 | become: yes | ||
46 | become_user: "{{ docker_username }}" | ||
47 | docker_network: | ||
48 | name: "{{ kanboard_network_name }}" | ||
49 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
50 | driver: bridge | ||
51 | ipam_config: | ||
52 | - subnet: "{{ kanboard_subnet }}" | ||
53 | gateway: "{{ kanboard_gateway }}" | ||
54 | |||
55 | - name: create and deploy kanboard container | ||
56 | become: yes | ||
57 | become_user: "{{ docker_username }}" | ||
58 | environment: | ||
59 | XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}" | ||
60 | docker_container: | ||
61 | name: "kanboard" | ||
62 | hostname: "kanboard" | ||
63 | image: "{{ image }}" | ||
64 | docker_host: "unix://run/user/{{ docker_uid }}/docker.sock" | ||
65 | purge_networks: yes | ||
66 | networks: | ||
67 | - name: "{{ kanboard_network_name }}" | ||
68 | ipv4_address: "{{ kanboard_ipv4 }}" | ||
69 | ports: | ||
70 | - "127.0.0.1:{{ kanboard_external_port }}:80" | ||
71 | volumes: | ||
72 | - "{{ docker_home }}/kanboard/data:/var/www/app/data" | ||
73 | - "{{ docker_home }}/kanboard/plugins:/var/www/app/plugins" | ||
74 | state: 'started' | ||
75 | recreate: yes | ||
76 | restart_policy: unless-stopped | ||
77 | |||
78 | - name: deploy nginx configuration | ||
79 | notify: restart nginx | ||
80 | template: | ||
81 | src: "{{ kanboard_nginx_config }}" | ||
82 | dest: /etc/nginx/sites-available/kanboard.conf | ||
83 | owner: root | ||
84 | group: root | ||
85 | mode: '0644' | ||
86 | |||
87 | - name: symlink site | ||
88 | file: | ||
89 | src: /etc/nginx/sites-available/kanboard.conf | ||
90 | dest: /etc/nginx/sites-enabled/kanboard.conf | ||
91 | owner: root | ||
92 | group: root | ||
93 | state: link | ||