aboutsummaryrefslogtreecommitdiff
path: root/roles/services/containers/bookstack/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/services/containers/bookstack/tasks')
-rw-r--r--roles/services/containers/bookstack/tasks/main.yml118
1 files changed, 118 insertions, 0 deletions
diff --git a/roles/services/containers/bookstack/tasks/main.yml b/roles/services/containers/bookstack/tasks/main.yml
new file mode 100644
index 0000000..3965143
--- /dev/null
+++ b/roles/services/containers/bookstack/tasks/main.yml
@@ -0,0 +1,118 @@
1- name: set image fact
2 set_fact:
3 image: linuxserver/bookstack:version-v23.05
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 bookstack directory
13 file:
14 path: "{{ docker_home }}/bookstack"
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 }}/bookstack/data"
23 state: directory
24 owner: "{{ docker_username }}"
25 group: "{{ docker_username }}"
26 mode: '0755'
27
28- name: create bookstack docker network
29 become: yes
30 become_user: "{{ docker_username }}"
31 docker_network:
32 name: "{{ bookstack_network_name }}"
33 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
34 driver: bridge
35 ipam_config:
36 - subnet: "{{ bookstack_subnet }}"
37 gateway: "{{ bookstack_gateway }}"
38
39- name: create and deploy bookstack db
40 become: yes
41 become_user: "{{ docker_username }}"
42 environment:
43 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
44 docker_container:
45 name: "bookstack-db"
46 hostname: "bookstack-db"
47 image: linuxserver/mariadb:10.11.4
48 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
49 purge_networks: yes
50 networks:
51 - name: "{{ bookstack_network_name }}"
52 ipv4_address: "{{ bookstack_db_ipv4 }}"
53 volumes:
54 - "{{ docker_home }}/bookstack/data:/config"
55 env:
56 "TZ": "{{ timezone }}"
57 "MYSQL_ROOT_PASSWORD": "{{ bookstack_mysql_root_password }}"
58 "MYSQL_DATABASE": "bookstack"
59 "MYSQL_USER": "bookstack"
60 "MYSQL_PASSWORD": "{{ bookstack_mysql_password }}"
61 state: 'started'
62 recreate: yes
63 restart_policy: unless-stopped
64
65- name: create and deploy bookstack container
66 become: yes
67 become_user: "{{ docker_username }}"
68 environment:
69 XDG_RUNTIME_DIR: "/run/user/{{ docker_uid }}"
70 docker_container:
71 name: "bookstack"
72 hostname: "bookstack"
73 image: "{{ image }}"
74 docker_host: "unix://run/user/{{ docker_uid }}/docker.sock"
75 purge_networks: yes
76 networks:
77 - name: "{{ bookstack_network_name }}"
78 ipv4_address: "{{ bookstack_ipv4 }}"
79 ports:
80 - "127.0.0.1:{{ bookstack_external_port }}:80"
81 volumes:
82 - "{{ docker_home }}/bookstack/data:/config"
83 env:
84 "DB_HOST": "bookstack-db"
85 "DB_PORT": "3306"
86 "DB_USER": "bookstack"
87 "DB_PASS": "{{ bookstack_mysql_password }}"
88 "DB_DATABASE": "bookstack"
89 "APP_URL": "https://{{ bookstack_server_name }}"
90 "AUTH_METHOD": "oidc"
91 "OIDC_NAME": "SSO"
92 "OIDC_DISPLAY_NAME_CLAIMS": "name"
93 "OIDC_CLIENT_ID": "bookstack"
94 "OIDC_CLIENT_SECRET": "{{ bookstack_oidc_secret }}"
95 "OIDC_ISSUER": "{{ oidc_issuer }}"
96 "OIDC_ISSUER_DISCOVER": "true"
97 "APP_DEFAULT_DARK_MODE": "true"
98 #"OIDC_DUMP_USER_DETAILS": "true"
99 state: 'started'
100 recreate: yes
101 restart_policy: unless-stopped
102
103- name: deploy nginx configuration
104 notify: restart nginx
105 template:
106 src: "{{ bookstack_nginx_config }}"
107 dest: /etc/nginx/sites-available/bookstack.conf
108 owner: root
109 group: root
110 mode: '0644'
111
112- name: symlink site
113 file:
114 src: /etc/nginx/sites-available/bookstack.conf
115 dest: /etc/nginx/sites-enabled/bookstack.conf
116 owner: root
117 group: root
118 state: link