docker and docker-compose added

This commit is contained in:
Zakaria 2024-08-11 20:48:34 +00:00
parent 9df9e6c1ee
commit fb5f9c25dd
3 changed files with 51 additions and 18 deletions

View File

@ -1,15 +0,0 @@
---
- hosts: all
become: yes
tasks:
- name: Install curl on Ubuntu servers
package:
name: curl
state: present
when: ansible_facts['os_family'] == 'Debian'
- name: Install curl on Fedora servers
dnf:
name: curl
state: present
when: ansible_facts['distribution'] == 'Fedora'

View File

@ -12,7 +12,10 @@ PaperlessNGX ansible_host=192.168.1.177
StirlingPDF ansible_host=192.168.1.176 StirlingPDF ansible_host=192.168.1.176
CodeServer ansible_host=192.168.1.179 CodeServer ansible_host=192.168.1.179
Gitea ansible_host=192.168.1.178 Gitea ansible_host=192.168.1.178
Radarr ansible_host=192.168.1.185
Sonarr ansible_host=192.168.1.186
Prowlarr ansible_host=192.168.1.187
qBittorrent ansible_host=192.168.1.188
[personal_laptop] [personal_laptop]
fedora ansible_host=192.168.1.175 ansible_user=ilyes fedora ansible_host=192.168.1.175 ansible_user=ilyes

View File

@ -1,4 +1,3 @@
---
- hosts: all - hosts: all
become: true become: true
tasks: tasks:
@ -14,6 +13,45 @@
state: present state: present
when: ansible_facts['os_family'] == "Debian" when: ansible_facts['os_family'] == "Debian"
- name: Install Docker (Debian/Ubuntu)
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
state: present
when: ansible_facts['os_family'] == "Debian"
- name: Add Docker GPG key (Debian/Ubuntu)
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
when: ansible_facts['os_family'] == "Debian"
- name: Add Docker repository (Debian/Ubuntu)
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable
state: present
when: ansible_facts['os_family'] == "Debian"
- name: Install Docker (Debian/Ubuntu)
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
when: ansible_facts['os_family'] == "Debian"
- name: Install Docker Compose (Debian/Ubuntu)
get_url:
url: https://github.com/docker/compose/releases/download/1.29.2/docker-compose-Linux-x86_64
dest: /usr/local/bin/docker-compose
mode: '0755'
when: ansible_facts['os_family'] == "Debian"
- name: See if a reboot is needed for Ubuntu/Debian pct - name: See if a reboot is needed for Ubuntu/Debian pct
shell: "needs-restarting -r > /dev/null; echo $?" shell: "needs-restarting -r > /dev/null; echo $?"
register: needsRestartingDebian register: needsRestartingDebian
@ -42,6 +80,14 @@
state: present state: present
when: ansible_facts['os_family'] == "RedHat" when: ansible_facts['os_family'] == "RedHat"
- name: Install Docker and Docker Compose (Fedora)
dnf:
name:
- docker
- docker-compose
state: present
when: ansible_facts['os_family'] == "RedHat"
- name: See if a reboot is needed (Fedora) - name: See if a reboot is needed (Fedora)
shell: "needs-restarting -r > /dev/null; echo $?" shell: "needs-restarting -r > /dev/null; echo $?"
register: needsRestartingFedora register: needsRestartingFedora
@ -57,4 +103,3 @@
reboot: reboot:
reboot_timeout: 600 reboot_timeout: 600
when: ansible_facts['os_family'] == "RedHat" and needsRestartingFedora.stdout == "1" when: ansible_facts['os_family'] == "RedHat" and needsRestartingFedora.stdout == "1"