Initial Ansible scenarios
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
- name: Reboot host
|
||||
ansible.builtin.reboot:
|
||||
reboot_timeout: 600
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Update all installed packages
|
||||
ansible.builtin.package:
|
||||
name: "*"
|
||||
state: latest
|
||||
|
||||
Reference in New Issue
Block a user