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 :
2024-11-14 16:41:30 +01:00
# - debug:
# msg: "{{ inventory_hostname }}"
# - debug:
# msg: "{{ destination_server }}"
2024-11-14 13:08:27 +01:00
- name : Install sqlite3
2024-11-14 13:02:39 +01:00
ansible.builtin.apt :
name :
- sqlite3
2024-11-14 13:03:08 +01:00
state : present
2024-11-14 13:09:23 +01:00
update_cache : yes
2024-11-14 13:04:46 +01:00
become : true
2024-11-14 13:09:23 +01:00
2024-11-14 13:04:46 +01:00
when : inventory_hostname == destination_server
2024-11-14 13:09:23 +01:00
2024-03-06 10:38:11 +01:00
- include_tasks : stop_containers.yaml
name : Stop Containers
2024-11-14 12:53:37 +01:00
when : inventory_hostname == destination_server
2024-11-14 13:25:30 +01:00
2024-03-06 10:38:11 +01:00
- name : Pause for 60 seconds
ansible.builtin.pause :
seconds : 60
2023-12-06 16:51:25 +01:00
2024-03-06 10:38:11 +01:00
- include_tasks : sync_container_data.yaml
name : Sync Container Data
2024-11-15 14:01:26 +01:00
when : inventory_hostname == source_server
2024-03-06 10:38:11 +01:00
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
2024-06-03 00:51:49 +02:00
- kestra.sectorq.eu
2024-06-03 01:12:06 +02:00
- auth.sectorq.eu
2024-11-14 12:53:37 +01:00
when : inventory_hostname == destination_server
2024-11-15 14:01:26 +01:00
2023-12-06 19:45:10 +01:00
- name : Get relevant configs
2024-06-03 00:51:49 +02:00
ansible.builtin.shell : 'egrep -l "# kestra.sectorq.eu|# auth.sectorq.eu|# 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/*'
2024-06-27 00:19:16 +02:00
ignore_errors : true
become : true
2023-12-06 19:45:10 +01:00
register : result
2024-11-14 12:53:37 +01:00
when : inventory_hostname == destination_server
2023-12-06 19:45:10 +01:00
- debug :
msg : "{{ result.stdout_lines }}"
2024-11-14 12:53:37 +01:00
when : inventory_hostname == destination_server
2023-12-06 19:45:10 +01:00
- name : Replace ip
ansible.builtin.lineinfile :
path : "{{ item }}"
regexp : '^\s+set \$server\s+\"\w+.\w+.\w+.\w+\";'
2024-11-14 12:53:37 +01:00
line : " set $server \"192.168.77.47\";"
2024-06-27 00:19:16 +02:00
become : true
2023-12-06 19:45:10 +01:00
with_items :
- "{{ result.stdout_lines }}"
2024-11-14 12:53:37 +01:00
when : inventory_hostname == destination_server
2023-12-06 15:18:07 +01:00
- include_tasks : reconfigure_heimdall.yaml
name : Reconfigure heimdall
loop :
- Home Assistant
- Nginx Proxy Manager
- Portainer
- Roundcube
2024-06-02 21:12:54 +02:00
- Authentik
2024-06-03 00:51:49 +02:00
- Kestra
2024-11-14 12:53:37 +01:00
when : inventory_hostname == destination_server
2023-12-06 15:18:07 +01:00
- 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
2024-11-14 13:30:10 +01:00
when : inventory_hostname == destination_server
2024-05-07 21:43:10 +02:00
# - include_tasks: start_containers.yaml
# name: Start Containers
# when: inventory_hostname in groups['raspberrypi5']
# - name: Pause for 60 seconds
# ansible.builtin.pause:
# seconds: 10
2024-04-24 08:33:27 +02:00
- name : Update gitlab perms
2024-04-24 08:47:09 +02:00
ansible.builtin.shell : 'docker exec -t gitlab update-permissions'
2024-06-27 00:19:16 +02:00
ignore_errors : true
become : true
2024-04-24 08:33:27 +02:00
register : result
2024-11-14 12:53:37 +01:00
when : inventory_hostname == destination_server
2024-04-24 08:26:08 +02:00
# - name: Get relevant configs
2024-04-24 08:33:27 +02:00
# ansible.builtin.shell: 'docker restart gitlab'
2024-04-24 08:26:08 +02:00
# ignore_errors: yes
# become: yes
# register: result
2024-04-24 08:33:27 +02:00
# when: inventory_hostname in groups['raspberrypi5']