mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 12:41:05 +01:00
Solved bugs
This commit is contained in:
parent
8c42d38bca
commit
0cd2b109e4
@ -3,7 +3,7 @@
|
||||
hosts: all
|
||||
become: true
|
||||
roles:
|
||||
- system-update
|
||||
- update
|
||||
|
||||
- name: servers host setup
|
||||
hosts: servers
|
||||
|
@ -27,16 +27,17 @@ def print_bash(command):
|
||||
return output
|
||||
|
||||
waiting_time=600
|
||||
backup_running=True
|
||||
while backup_running:
|
||||
blocker_running=True
|
||||
while blocker_running:
|
||||
try:
|
||||
bash("systemctl is-active --quiet docker-volume-backup.service")
|
||||
bash("systemctl is-active --quiet update-docker.service")
|
||||
print("backup is running.")
|
||||
print("trying again in " + str(waiting_time) + " seconds.")
|
||||
time.sleep(waiting_time)
|
||||
except:
|
||||
backup_running=False
|
||||
print("no backup is running.")
|
||||
blocker_running=False
|
||||
print("No blocking service is running.")
|
||||
|
||||
unhealthy_container_names=print_bash('docker ps --filter health=unhealthy --format \'{{.Names}}\'')
|
||||
exited_container_names=print_bash('docker ps --filter status=exited --format \'{{.Names}}\'')
|
||||
|
@ -1,25 +1,4 @@
|
||||
---
|
||||
- name: Wait in a loop until the service update-docker.service is inactive
|
||||
block:
|
||||
- name: Check the status of update-docker.service
|
||||
command: systemctl is-active update-docker.service
|
||||
register: service_status
|
||||
changed_when: false
|
||||
failed_when: service_status.stdout == 'active'
|
||||
|
||||
- name: Pause for 60 seconds if the service is still active
|
||||
pause:
|
||||
seconds: 60
|
||||
when: service_status.stdout == 'active'
|
||||
become: true
|
||||
until: service_status.stdout != 'active'
|
||||
retries: 720
|
||||
delay: 10
|
||||
|
||||
- name: Abort if the service is still active after the maximum attempts
|
||||
fail:
|
||||
msg: "The update-docker.service is still active after the maximum number of attempts."
|
||||
when: service_status.stdout == 'active' and service_status.attempts == 10
|
||||
|
||||
- name: docker & docker compose install
|
||||
pacman:
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
- name: configure update-docker.service
|
||||
template:
|
||||
src: update-docker.service
|
||||
src: update-docker.service.j2
|
||||
dest: /etc/systemd/system/update-docker.service
|
||||
|
||||
- name: "reload update-docker.service"
|
||||
|
@ -1,10 +0,0 @@
|
||||
tasks:
|
||||
- name: "Check if {{path_docker_compose_files}} directory exists"
|
||||
stat:
|
||||
path: {{path_docker_compose_files}}
|
||||
register: docker_compose_directory_stat
|
||||
|
||||
roles:
|
||||
- { role: update-pacman, when: ansible_distribution == 'Archlinux' }
|
||||
- { role: update-apt, when: ansible_distribution == "Debian" }
|
||||
- { role: update-docker, when: docker_compose_directory_stat.stat.exists }
|
20
roles/update/tasks/main.yml
Normal file
20
roles/update/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
- name: "Check if {{ path_docker_compose_files }} directory exists"
|
||||
stat:
|
||||
path: "{{ path_docker_compose_files }}"
|
||||
register: docker_compose_directory_stat
|
||||
|
||||
- name: "Update with pacman"
|
||||
include_role:
|
||||
name: update-pacman
|
||||
when: ansible_distribution == 'Archlinux' and docker_compose_directory_stat.stat.exists
|
||||
|
||||
- name: "Update with apt"
|
||||
include_role:
|
||||
name: update-apt
|
||||
when: ansible_distribution == "Debian" and docker_compose_directory_stat.stat.exists
|
||||
|
||||
- name: "Update Docker Images"
|
||||
include_role:
|
||||
name: update-docker
|
||||
when: docker_compose_directory_stat.stat.exists
|
Loading…
Reference in New Issue
Block a user