132 lines
3.4 KiB
YAML
132 lines
3.4 KiB
YAML
---
|
|
- hosts: all
|
|
become: yes
|
|
remote_user: ansible
|
|
gather_facts: false
|
|
|
|
vars:
|
|
docker_compose_definition: |
|
|
services:
|
|
bookstack:
|
|
image: lscr.io/linuxserver/bookstack
|
|
container_name: bookstack
|
|
environment:
|
|
- PUID=2000
|
|
- PGID=996
|
|
- TZ=America/Chicago
|
|
- APP_URL=http://192.168.0.56:8080
|
|
- DB_HOST=bookstack_db
|
|
- DB_PORT=3306
|
|
- DB_USER=bookstack
|
|
- DB_PASS=Wp6DwHwFCAToFhEYDhcrMI3
|
|
- DB_DATABASE=bookstackapp
|
|
volumes:
|
|
- /data/app:/config
|
|
ports:
|
|
- 8080:80
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- bookstack_db
|
|
|
|
bookstack_db:
|
|
image: lscr.io/linuxserver/mariadb
|
|
container_name: bookstack_db
|
|
environment:
|
|
- PUID=2000
|
|
- PGID=996
|
|
- TZ=America/Chicago
|
|
- MYSQL_ROOT_PASSWORD=yNTUxOQAAACADSWp6DwHwFCA
|
|
- MYSQL_DATABASE=bookstackapp
|
|
- MYSQL_USER=bookstack
|
|
- MYSQL_PASSWORD=Wp6DwHwFCAToFhEYDhcrMI3
|
|
volumes:
|
|
- /data/db:/config
|
|
restart: unless-stopped
|
|
|
|
tasks:
|
|
- name: set-debcache.yml - Setup apt proxy debcache
|
|
import_tasks: ../../lib/set-debcache.yml
|
|
|
|
- name: Upgrade-packages.yml - update packages
|
|
import_tasks: ../../lib/upgrade-packages.yml
|
|
|
|
- name: Install-docker.yml - setting up docker
|
|
import_tasks: ../../lib/install-docker.yml
|
|
|
|
- name: Setup-netbird.yml - setting up netbird mesh vpn
|
|
import_tasks: ../../lib/setup-netbird.yml
|
|
|
|
- name: Create wikmd user
|
|
user:
|
|
name: wikmd
|
|
uid: 2002
|
|
group: users
|
|
state: present
|
|
create_home: yes
|
|
home: /data
|
|
shell: /bin/bash
|
|
|
|
- name: Install Python Packages
|
|
apt:
|
|
name:
|
|
- python3-full
|
|
- python3-pip
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: Setup Service
|
|
copy:
|
|
dest: /etc/systemd/system/wikmd.service
|
|
content: |
|
|
[Unit]
|
|
Description=Wikmd
|
|
After=network.target
|
|
|
|
[Service]
|
|
User=wikmd
|
|
WorkingDirectory=/data/wikmd
|
|
ExecStart=/bin/bash StartWikmd.sh
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
# docker image is broken using manual install method
|
|
#- name: Write docker-compose.yml
|
|
# ansible.builtin.copy:
|
|
# content: "{{ docker_compose_definition }}"
|
|
# dest: /home/docker/docker-compose.yml
|
|
# owner: docker
|
|
# group: docker
|
|
# mode: u=rw,g=r,o=r
|
|
|
|
#- name: Start services
|
|
# community.docker.docker_compose_v2:
|
|
# project_src: /home/docker/
|
|
# register: output
|
|
|
|
- name: Check if wikmd directory exists
|
|
stat:
|
|
path: /data/wikmd
|
|
register: wikmd_stat
|
|
|
|
- name: Restore Wikmd Dir
|
|
shell: |
|
|
restic --password-file /home/restic/.resticpassword -r sftp:misamisa://home/restic/$(hostname) --target / restore latest
|
|
args:
|
|
chdir: /home/restic
|
|
creates: /data/wikmd
|
|
when: not wikmd_stat.stat.exists or not wikmd_stat.stat.isdir
|
|
|
|
- name: Reload systemd daemon
|
|
systemd:
|
|
daemon_reload: yes
|
|
|
|
- name: Start Wikmd Service
|
|
systemd:
|
|
name: wikmd
|
|
state: started
|
|
enabled: yes |