Initial Ansible scenarios

This commit is contained in:
2026-07-26 22:31:48 +03:00
commit 23c9fd55af
11 changed files with 172 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
---
- name: List running Docker Compose projects
ansible.builtin.command:
argv:
- docker
- compose
- ls
- --format
- json
register: docker_compose_projects
changed_when: false
- name: Select running Docker Compose projects
ansible.builtin.set_fact:
running_compose_projects: "{{ docker_compose_projects.stdout | from_json }}"
- name: Pull images for each running Docker Compose project
ansible.builtin.command:
argv:
- docker
- compose
- -p
- "{{ item.Name }}"
- pull
environment:
COMPOSE_FILE: "{{ item.ConfigFiles | replace(',', ':') }}"
loop: "{{ running_compose_projects }}"
loop_control:
label: "{{ item.Name }}"
changed_when: true
- name: Recreate Docker Compose containers with updated images
ansible.builtin.command:
argv:
- docker
- compose
- -p
- "{{ item.Name }}"
- up
- -d
environment:
COMPOSE_FILE: "{{ item.ConfigFiles | replace(',', ':') }}"
loop: "{{ running_compose_projects }}"
loop_control:
label: "{{ item.Name }}"
changed_when: true
+5
View File
@@ -0,0 +1,5 @@
---
- name: Reboot host
ansible.builtin.reboot:
reboot_timeout: 600
+17
View File
@@ -0,0 +1,17 @@
---
- name: Install common utilities
ansible.builtin.package:
name:
- mc
- htop
- iotop
- curl
- git
- bash-completion
- unzip
- ca-certificates
- gnupg
- net-tools
- btop
state: present
+6
View File
@@ -0,0 +1,6 @@
---
- name: Update all installed packages
ansible.builtin.package:
name: "*"
state: latest