v.1.5.0 docker-compose-update.yaml; apt clean
This commit is contained in:
@@ -10,3 +10,7 @@ ansible-playbook system-upgrade.yml
|
|||||||
```bash
|
```bash
|
||||||
ansible-playbook local-upgrade.yaml --become --ask-become-pass
|
ansible-playbook local-upgrade.yaml --become --ask-become-pass
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook docker-compose-update.yaml
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
[defaults]
|
[defaults]
|
||||||
|
interpreter_python = /usr/bin/python3
|
||||||
inventory=inventory
|
inventory=inventory
|
||||||
private_key_file=~/.ssh/id_ed25519
|
private_key_file=~/.ssh/id_ed25519
|
||||||
remote_user=ansible
|
remote_user=ansible
|
||||||
|
|||||||
47
docker-compose-update.yaml
Normal file
47
docker-compose-update.yaml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
### noch nicht ok !!!!
|
||||||
|
### keine Rechte fuer User ansible
|
||||||
|
- name: Manage Docker Compose services
|
||||||
|
hosts: wiki, paperless, mongodb, gitea, newt-pangolin, jenkins
|
||||||
|
# hosts: wiki
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
host_compose_dirs:
|
||||||
|
wiki: "/home/admin/wikijs"
|
||||||
|
paperless: "/home/admin"
|
||||||
|
mongodb: "/home/admin/mongodb"
|
||||||
|
gitea: "/home/admin"
|
||||||
|
newt-pangolin: "/home/admin/newt"
|
||||||
|
jenkins: "/home/admin/jenkins"
|
||||||
|
force_pull: false
|
||||||
|
force_recreate: false
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Stop and remove containers
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ host_compose_dirs[inventory_hostname] }}"
|
||||||
|
state: absent
|
||||||
|
register: compose_down
|
||||||
|
|
||||||
|
- name: Pull latest images
|
||||||
|
community.docker.docker_compose_v2_pull:
|
||||||
|
project_src: "{{ host_compose_dirs[inventory_hostname] }}"
|
||||||
|
# Remove the 'pull' parameter - the module always pulls by default
|
||||||
|
# Add policy if you want to control pull behavior
|
||||||
|
policy: "always" # or "missing" or "build"
|
||||||
|
when: compose_down.changed or force_pull
|
||||||
|
register: compose_pull
|
||||||
|
|
||||||
|
- name: Start services
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ host_compose_dirs[inventory_hostname] }}"
|
||||||
|
state: present
|
||||||
|
recreate: "{{ 'always' if force_recreate else 'auto' }}"
|
||||||
|
register: compose_up
|
||||||
|
|
||||||
|
- name: Display operation results
|
||||||
|
debug:
|
||||||
|
msg: |
|
||||||
|
Host: {{ inventory_hostname }}
|
||||||
|
Services down: {{ compose_down.changed }}
|
||||||
|
Images pulled: {{ compose_pull.changed if compose_pull is defined else 'skipped' }}
|
||||||
|
Services up: {{ compose_up.changed }}
|
||||||
@@ -8,3 +8,7 @@
|
|||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
update_cache: yes
|
update_cache: yes
|
||||||
upgrade: safe
|
upgrade: safe
|
||||||
|
|
||||||
|
- name: Run the equivalent of "apt clean"
|
||||||
|
ansible.builtin.apt:
|
||||||
|
clean: yes
|
||||||
|
|||||||
@@ -10,6 +10,10 @@
|
|||||||
update_cache: yes
|
update_cache: yes
|
||||||
upgrade: safe
|
upgrade: safe
|
||||||
|
|
||||||
|
- name: Run the equivalent of "apt clean"
|
||||||
|
ansible.builtin.apt:
|
||||||
|
clean: yes
|
||||||
|
|
||||||
- hosts: homelab
|
- hosts: homelab
|
||||||
become: true
|
become: true
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
|
|||||||
Reference in New Issue
Block a user