diff --git a/hosts.yml b/hosts.yml index 9617fa7..a2e6d09 100644 --- a/hosts.yml +++ b/hosts.yml @@ -16,5 +16,8 @@ all: hosts: 10.11.12.35: audiobookshelf_hosts: + hosts: + 10.11.12.35: + wiki_js_hosts: hosts: 10.11.12.35: \ No newline at end of file diff --git a/main.yml b/main.yml index d1477a8..591bc18 100644 --- a/main.yml +++ b/main.yml @@ -39,4 +39,11 @@ become: true roles: - audiobookshelf - tags: audiobookshelf \ No newline at end of file + tags: audiobookshelf + +- name: Configure Wiki_Js + hosts: wiki_js_hosts + become: true + roles: + - wiki_js + tags: wiki_js \ No newline at end of file diff --git a/roles/wiki_js/tasks/main.yml b/roles/wiki_js/tasks/main.yml new file mode 100644 index 0000000..cc32e0d --- /dev/null +++ b/roles/wiki_js/tasks/main.yml @@ -0,0 +1,51 @@ +--- +- name: Create Wiki_JS directories they do not exist + become: true + ansible.builtin.file: + path: /home/{{ user['name'] }}/docker/wiki_js/{{ item }} + state: directory + mode: '0755' + loop: '{{ wiki_js_folder }}' + +- name: Create docker network 'wiki_js_internal' + community.docker.docker_network: + name: wiki_js_internal + +- name: Create docker network 'proxy' + community.docker.docker_network: + name: proxy + +- name: Create wiki_js DB Container + community.docker.docker_container: + name: wiki_js_db + image: 'postgres:11-alpine' + state: started + restart_policy: unless-stopped + env: + POSTGRES_DB: "{{ WIKI_JS_POSTGRES_DB | string }}" + POSTGRES_USER: "{{ WIKI_JS_POSTGRES_USER | string }}" + POSTGRES_PASSWORD: "{{ WIKI_JS_POSTGRES_PASS | string }}" + volumes: + - /home/{{ user['name'] }}/docker/wiki_js/db:/var/lib/postgresql/data + networks: + - name: wiki_js_internal + +- name: Create Wiki_JS Container + community.docker.docker_container: + name: wiki_js_app + image: 'ghcr.io/requarks/wiki:2' + pull: yes + state: started + restart_policy: unless-stopped + ports: + - '11003:3000' + env: + DB_TYPE: "{{ WIKI_JS_DB_TYPE | string}}" + DB_HOST: "{{ WIKI_JS_DB_HOST | string}}" + DB_PORT: "{{ WIKI_JS_DB_PORT | string }}" + DB_USER: "{{ WIKI_JS_POSTGRES_USER | string }}" + DB_PASS: "{{ WIKI_JS_POSTGRES_PASS | string }}" + DB_NAME: "{{ WIKI_JS_POSTGRES_DB | string }}" + networks: + - name: wiki_js_internal + - name: proxy diff --git a/roles/wiki_js/vars/main.yml b/roles/wiki_js/vars/main.yml new file mode 100644 index 0000000..c122ed2 --- /dev/null +++ b/roles/wiki_js/vars/main.yml @@ -0,0 +1,9 @@ +wiki_js_folder: + - db + +WIKI_JS_DB_TYPE: 'postgres' +WIKI_JS_DB_HOST: 'wiki_js_db' +WIKI_JS_DB_PORT: '5432' +WIKI_JS_POSTGRES_DB: 'wiki' +WIKI_JS_POSTGRES_USER: 'wiki' +WIKI_JS_POSTGRES_PASS: 'XwnYnsa&b5s5ner8wh6bNZEC&K5aNnBh'