First Commit

This commit is contained in:
madereddy
2023-12-11 14:06:37 -05:00
commit e8648367dd
11 changed files with 439 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
- name: Install Docker on Debian, Ubuntu, or Raspbian
hosts: all
become: yes
gather_facts: yes
tasks:
- name: Install Docker dependencies for Debian/Ubuntu/Raspbian
apt:
name:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- lsb-release
state: present
update_cache: yes
when: ansible_os_family == "Debian"
- name: Add Docker GPG key for Debian/Ubuntu/Raspbian
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
when: ansible_os_family == "Debian"
- name: Add Docker repository for Debian/Ubuntu
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
update_cache: yes
when: ansible_os_family == "Debian" and ansible_distribution == "Ubuntu"
- name: Add Docker repository for Raspbian/Debian
apt_repository:
repo: "deb [arch=arm64] https://download.docker.com/linux/debian {{ ansible_distribution_release }} stable"
state: present
update_cache: yes
when: ansible_os_family == "Debian" and ansible_architecture == "aarch64"
- name: Install Docker for Debian/Ubuntu/Raspbian
apt:
name: docker-ce
state: present
update_cache: yes
- name: Add authenticated user to Docker group
user:
name: "{{ ansible_user }}"
groups: docker
append: yes
- name: Ensure Docker service is enabled and started
systemd:
name: docker
enabled: yes
state: started
- name: Reset connection to refresh user group membership
meta: reset_connection