Add Windows Host

This commit is contained in:
madereddy
2023-12-14 15:27:40 -05:00
parent a80fba6b8b
commit 574fa1517a
5 changed files with 16 additions and 63 deletions
+2 -2
View File
@@ -6,11 +6,11 @@
- name: Stop containers using Docker Compose
ansible.builtin.command:
cmd: docker compose down
chdir: /home/jeet/docker
chdir: ~/docker
ignore_errors: yes
- name: Remove build folder
ansible.builtin.file:
state: absent
path: /home/jeet/docker/
path: ~/docker/
force: true
-52
View File
@@ -1,52 +0,0 @@
---
- name: Update Docker Containers With New Images
hosts: Docker
gather_facts: yes
tasks:
- name: Stop and remove Docker containers
ansible.builtin.command: docker compose down
args:
chdir: "{{ compose_file_path | dirname }}"
loop: "{{ compose_file_paths }}"
ignore_errors: yes
loop_control:
loop_var: compose_file_path
- name: Run docker compose up
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ compose_file_path | dirname }}"
loop: "{{ compose_file_paths }}"
loop_control:
loop_var: compose_file_path
- name: Pause for 60 seconds to allow containers to stabilize
ansible.builtin.pause:
seconds: 60
- name: Check container status
ansible.builtin.shell: docker compose ps -q | xargs -n1 docker container inspect --format '{{ "{{" }} .State.Running {{ "}}" }}'
args:
chdir: "{{ compose_file_path | dirname }}"
loop: "{{ compose_file_paths }}"
register: container_status
ignore_errors: yes
loop_control:
loop_var: compose_file_path
- name: Conditional restart of containers
ansible.builtin.command: docker compose up -d
args:
chdir: "{{ result_item.item.path | dirname }}"
loop: "{{ container_status.results }}"
when: "'false' in result_item.stdout"
register: restart_status
loop_control:
loop_var: result_item
- name: Pause for 60 seconds to allow containers to stabilize
ansible.builtin.pause:
seconds: 60
- import_playbook: docker_status.yml
+7
View File
@@ -23,5 +23,12 @@
state: latest
when: ansible_distribution == "Fedora"
# For Windows Hosts
- name: Install all updates and reboot as many times as needed
ansible.windows.win_updates:
category_names: '*'
reboot: true
when: ansible_os_family == "Windows"
# Specific adjustments for Raspbian can be made here, if necessary
# Raspbian will typically be covered by the Debian task, but if you have specific needs, you can specify them here.