first commit

This commit is contained in:
2024-10-05 10:06:52 +02:00
commit 0784cad8af
57 changed files with 965 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
---
- name: Install colima
tags:
- install
when: desktop_pkgs
ansible.builtin.package:
name: colima

View File

@@ -0,0 +1,6 @@
---
- name: Install on MacOS
when: mac_os
tags:
- install
ansible.builtin.include_tasks: macos.yml

View File

@@ -0,0 +1,92 @@
---
# https://medium.com/@GarisSpace/how-to-install-docker-using-ansible-01a674086f8c
- name: Setting host facts
ansible.builtin.set_fact:
arch_mapping: # Map ansible architecture {{ ansible_architecture }} names to Docker's architecture names
x86_64: amd64
aarch64: arm64
tags:
- always
- name: Install required packages
tags:
- install
ansible.builtin.apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- gnupg
- software-properties-common
- name: Create directory for Docker's GPG key
tags:
- install
ansible.builtin.file:
path: /etc/apt/keyrings
state: directory
mode: "0755"
- name: Add Docker's official GPG key
tags:
- install
ansible.builtin.apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
keyring: /etc/apt/keyrings/docker.gpg
state: present
- name: Print architecture variables
tags:
- install
ansible.builtin.debug:
msg: "Architecture: {{ ansible_architecture }}, Codename: {{ ansible_lsb.codename }}"
- name: Add Docker repository
tags:
- install
ansible.builtin.apt_repository:
repo: >-
deb [arch={{ arch_mapping[ansible_architecture] | default(ansible_architecture) }}
signed-by=/etc/apt/keyrings/docker.gpg]
https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable
filename: docker
state: present
- name: Install Docker and related packages
tags:
- install
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
update_cache: true
- name: Add Docker group
tags:
- install
ansible.builtin.group:
name: docker
state: present
- name: Add user to Docker group
tags:
- install
ansible.builtin.user:
name: "{{ username }}"
groups: docker
append: true
- name: Enable and start Docker services
tags:
- install
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
loop:
- docker.service
- containerd.service