67 lines
2.0 KiB
YAML
67 lines
2.0 KiB
YAML
---
|
|
- name: Setup-LXC containers
|
|
hosts: localhost
|
|
become: true
|
|
gather_facts: true
|
|
|
|
vars_files:
|
|
- ./vault.yaml
|
|
|
|
vars:
|
|
restic_repo: "s3:http://misamisa.duckdns.org:9000/resticbackup"
|
|
restore_target_path: "/"
|
|
# restic_password_value: "Stored in vault"
|
|
|
|
tasks:
|
|
- name: Set-debcache.yml - Setup apt proxy debcache
|
|
ansible.builtin.import_tasks: ./setup-debcache.yaml
|
|
|
|
- name: Upgrade-packages.yml - update packages
|
|
ansible.builtin.import_tasks: ./upgrade-packages.yaml
|
|
|
|
- name: Install-docker.yml - setting up docker
|
|
ansible.builtin.import_tasks: ./setup-docker.yaml
|
|
|
|
- name: Setup-netbird.yml - setting up netbird mesh vpn
|
|
ansible.builtin.import_tasks: ./setup-netbird.yaml
|
|
|
|
- name: Setup-restic.yml - setup restic
|
|
ansible.builtin.import_tasks: ./setup-restic.yaml
|
|
|
|
- name: Check if app data directory exists
|
|
stat:
|
|
path: "/apps/"
|
|
register: app_data
|
|
|
|
- name: Restic restore app data Dir
|
|
ansible.builtin.shell:
|
|
cmd: "restic restore latest --tag {{ ansible_hostname }} --target {{ restore_target_path }}"
|
|
environment:
|
|
RESTIC_REPOSITORY: "{{ restic_repo }}"
|
|
RESTIC_PASSWORD: "{{ restic_password_value }}"
|
|
AWS_ACCESS_KEY_ID: "{{ aws_access_key_id }}"
|
|
AWS_SECRET_ACCESS_KEY: "{{ aws_secret_access_key }}"
|
|
args:
|
|
creates: "/app/data"
|
|
|
|
when: not app_data.stat.exists or not app_data.stat.isdir
|
|
|
|
- name: Copy docker-compose.yml from repo
|
|
ansible.builtin.copy:
|
|
src: ./{{ ansible_hostname }}/docker-compose.yml
|
|
dest: /apps/docker/docker-compose.yml
|
|
|
|
- name: Copy docker-compose.env from repo
|
|
ansible.builtin.copy:
|
|
src: ./{{ ansible_hostname }}/docker-compose.env
|
|
dest: /apps/docker/docker-compose.env
|
|
|
|
- name: Reload systemd daemon
|
|
systemd:
|
|
daemon_reload: yes
|
|
|
|
- name: Start App Service
|
|
systemd:
|
|
name: app
|
|
state: started
|
|
enabled: yes |