2023-12-06 15:18:07 +01:00
---
- name : import a task
hosts : containers
gather_facts : false
2023-12-06 08:37:34 +01:00
tasks :
2023-12-09 15:50:11 +01:00
# - include_tasks: stop_containers.yaml
# name: Stop Containers
# when: inventory_hostname in groups['raspberrypi5']
# - name: Pause for 60 seconds
# ansible.builtin.pause:
# seconds: 60
2023-12-06 16:51:25 +01:00
2023-12-09 15:50:11 +01:00
# - include_tasks: sync_container_data.yaml
# name: Sync Container Data
2024-03-06 10:35:43 +01:00
- name : Syncing all
ansible.builtin.shell : 'rsync -avh --delete /share/docker_data/{mailu2,ha,gitlab,semaphore,webhub,nginx,heimdall} root@192.168.77.238:/share/docker_data/ --exclude="home-assistant.log*" --exclude="gitlab/logs/*"'
#ansible.builtin.shell: 'rsync -avh --delete /share/docker_data/{mailu2,webhub,nginx,heimdall,ha,gitlab} root@192.168.77.238:/share/docker_data/ --exclude="home-assistant.log*" --exclude="gitlab/logs/*"'
#ansible.builtin.shell: 'ls -la'
when : inventory_hostname in groups['nas']
2023-12-06 15:18:07 +01:00
- include_tasks : reconfigure_nginx.yaml
name : Reconfigure nginx proxy manager
loop :
- sectorq.eu
- gitlab.sectorq.eu
- ha.sectorq.eu
- mail.sectorq.eu
- pw.sectorq.eu
- semaphore.sectorq.eu
when : inventory_hostname in groups['raspberrypi5']
2023-12-06 19:45:10 +01:00
- name : Get relevant configs
ansible.builtin.shell : 'egrep -l "# ha.sectorq.eu|# pw.sectorq.eu|# semaphore.sectorq.eu|# sectorq.eu|# gitlab.sectorq.eu|# ha.sectorq.eu" /share/docker_data/nginx/data/nginx/proxy_host/*'
ignore_errors : yes
become : yes
register : result
when : inventory_hostname in groups['raspberrypi5']
- debug :
msg : "{{ result.stdout_lines }}"
when : inventory_hostname in groups['raspberrypi5']
- name : Replace ip
ansible.builtin.lineinfile :
path : "{{ item }}"
regexp : '^\s+set \$server\s+\"\w+.\w+.\w+.\w+\";'
line : " set $server \"192.168.77.238\";"
become : yes
with_items :
- "{{ result.stdout_lines }}"
when : inventory_hostname in groups['raspberrypi5']
2023-12-06 15:18:07 +01:00
- include_tasks : reconfigure_heimdall.yaml
name : Reconfigure heimdall
loop :
- Home Assistant
- Nginx Proxy Manager
- Portainer
- Roundcube
when : inventory_hostname in groups['raspberrypi5']
- name : Changing heimdall background
ansible.builtin.shell : sqlite3 /share/docker_data/heimdall/config/www/app.sqlite "UPDATE setting_user SET uservalue = 'backgrounds/TRN2Ydr5dyVAkWvCq4xqR5bQ6iyv5XaKvM1r84sJ.jpg' WHERE user_id = (SELECT id FROM users WHERE username = 'jaydee')"
2023-12-06 08:37:34 +01:00
become : true
2023-12-06 15:18:07 +01:00
when : inventory_hostname in groups['raspberrypi5']
2023-12-06 16:51:25 +01:00
- include_tasks : start_containers.yaml
name : Start Containers
2023-12-10 13:35:30 +01:00
when : inventory_hostname in groups['raspberrypi5']
- name : Get relevant configs
ansible.builtin.shell : 'docker exec -it gitlab update-permissions'
ignore_errors : yes
become : yes
register : result
when : inventory_hostname in groups['raspberrypi5']
- name : Get relevant configs
ansible.builtin.shell : 'docker restart gitlab'
ignore_errors : yes
become : yes
register : result
2023-12-06 16:51:25 +01:00
when : inventory_hostname in groups['raspberrypi5']