diff --git a/ansible/roles/docker/files/wallabag/docker-compose.yml b/ansible/roles/docker/files/wallabag/docker-compose.yml new file mode 100644 index 0000000..ff6b69b --- /dev/null +++ b/ansible/roles/docker/files/wallabag/docker-compose.yml @@ -0,0 +1,24 @@ +version: "2.3" + +services: + wallabag: + image: wallabag/wallabag:2.3.8 + container_name: wallabag + restart: unless-stopped + environment: + - SYMFONY__ENV__SECRET={{ wallabag_secret }} + - SYMFONY__ENV__DOMAIN_NAME=https://wallabag.jakehoward.tech + volumes: + - ./data:/var/www/wallabag/data + - ./images:/var/www/wallabag/images + labels: + - "traefik.enable=true" + - "traefik.http.routers.wallabag.rule=Host(`wallabag.jakehoward.tech`)" + - "traefik.http.routers.wallabag.tls=true" + - "traefik.http.routers.wallabag.tls.certresolver=le" + + redis: + image: redis:5-alpine + restart: unless-stopped + volumes: + - ./redis:/data diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml index b693181..43b5b90 100644 --- a/ansible/roles/docker/tasks/main.yml +++ b/ansible/roles/docker/tasks/main.yml @@ -66,3 +66,6 @@ - name: Install statping include: statping.yml + +- name: Install wallabag + include: wallabag.yml diff --git a/ansible/roles/docker/tasks/wallabag.yml b/ansible/roles/docker/tasks/wallabag.yml new file mode 100644 index 0000000..e5a07f0 --- /dev/null +++ b/ansible/roles/docker/tasks/wallabag.yml @@ -0,0 +1,34 @@ +- name: Include wallabag variables + include_vars: wallabag.yml + +- name: Create wallabag directory + file: + path: '/opt/wallabag' + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + become_user: root + +- name: Install wallabag compose file + template: + src: files/wallabag/docker-compose.yml + dest: "/opt/wallabag/docker-compose.yml" + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: /usr/bin/docker-compose -f %s config + register: compose_file + become: true + become_user: root + +- name: Cycle wallabag container + docker_compose: + project_src: /opt/wallabag + pull: true + remove_orphans: true + remove_volumes: true + state: "{{ item }}" + when: compose_file.changed + loop: + - absent + - present diff --git a/ansible/roles/docker/vars/wallabag.yml b/ansible/roles/docker/vars/wallabag.yml new file mode 100644 index 0000000..409b5f7 --- /dev/null +++ b/ansible/roles/docker/vars/wallabag.yml @@ -0,0 +1,11 @@ +wallabag_secret: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 64353939666265306238333239316631373533643030663638316338356330653539643837373637 + 6638323330373264363535316339616432373132613939360a653533393164386266646337663234 + 33306333663165303431343537336465383937646437643630313037326135643666656435373331 + 6563303734643532370a313361656434333537366636366265653861656636386164373261666633 + 31646263326539303862386261623938323338333839656135656663643231653361663438326136 + 65306537383931393432633561333131386138333132383737383539646233313735613566633537 + 61656630396333376635393264346266356238626134316331623638393234363161336439303939 + 31393361393432366638613865323663326630306432363364663266663264656339323939306266 + 62646464306363353032326638613361633433303433633361656662353237396631