xbazzi e7ba86f10a
All checks were successful
Simple Mirror to GitHub / mirror (push) Successful in 35s
Feat: add scylladb + a bunch of stuff I forgot to commit earlier
2025-08-21 23:43:52 -06:00

157 lines
4.5 KiB
YAML

---
# - name: Ensure GPG and curl are installed
# ansible.builtin.apt:
# name:
# - curl
# - gnupg
# state: present
# update_cache: true
# - name: Create keyrings directory
# ansible.builtin.file:
# path: /etc/apt/keyrings
# state: directory
# mode: '0755'
# - name: Download and dearmor Docker GPG key
# ansible.builtin.shell: |
# curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# args:
# creates: /etc/apt/keyrings/docker.gpg
# - name: Set proper permissions on the GPG key
# ansible.builtin.file:
# path: /etc/apt/keyrings/docker.gpg
# mode: '0644'
# - name: Add Docker APT repository (correct for Debian)
# ansible.builtin.copy:
# dest: /etc/apt/sources.list.d/docker.list
# content: |
# deb [arch={{ ansible_architecture }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ ansible_lsb.codename }} stable
# mode: '0644'
# notify: Update apt cache
- name: Ensure dependencies for Docker key
apt:
name:
- curl
- gnupg
state: present
update_cache: true
- name: Remove any broken docker keyrings or source files
file:
path: "{{ item }}"
state: absent
loop:
- /etc/apt/keyrings/docker.gpg
- /etc/apt/keyrings/docker.asc
- /etc/apt/sources.list.d/docker.list
- name: Create keyring directory
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
- name: Download and dearmor Docker GPG key
shell: |
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
args:
creates: /etc/apt/keyrings/docker.gpg
- name: Set correct permissions on Docker GPG key
file:
path: /etc/apt/keyrings/docker.gpg
mode: '0644'
# - name: Add Docker APT repository
# copy:
# dest: /etc/apt/sources.list.d/docker.list
# content: |
# deb [arch={{ ansible_architecture }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ ansible_lsb.codename }} stable
# mode: '0644'
- name: Add Docker APT repository (correct for Debian)
ansible.builtin.copy:
dest: /etc/apt/sources.list.d/docker.list
content: |
deb [arch={{ ansible_architecture | regex_replace('x86_64', 'amd64') }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ ansible_lsb.codename }} stable
mode: '0644'
- name: Update apt cache
apt:
update_cache: yes
# - name: Update apt cache manually if needed
# ansible.builtin.apt:
# update_cache: true
# when: ansible_run_tags is not defined or 'skip_cache' not in ansible_run_tags
# - name: Update apt cache
# ansible.builtin.apt:
# update_cache: yes
# - name: Install prerequisite packages
# ansible.builtin.apt:
# name:
# - ca-certificates
# - curl
# state: present
# - name: Create apt keyrings directory
# ansible.builtin.file:
# path: /etc/apt/keyrings
# state: directory
# mode: '0755'
# - name: Download Docker GPG key (dearmor format)
# ansible.builtin.get_url:
# url: https://download.docker.com/linux/debian/gpg
# dest: /etc/apt/keyrings/docker.gpg
# mode: '0644'
# - name: Add Docker apt repository
# ansible.builtin.apt_repository:
# repo: "deb [arch={{ docker_arch }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
# filename: docker
# state: present
# vars:
# docker_arch: "{{ ansible_architecture | regex_replace('x86_64', 'amd64') }}"
# - name: Add Docker apt repository for Debian
# ansible.builtin.apt_repository:
# repo: "deb [arch={{ ansible_architecture }} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian {{ ansible_lsb.codename }} stable"
# filename: docker
# state: present
# update_cache: true
# - name: Update apt cache after adding Docker repository
# ansible.builtin.apt:
# update_cache: true
- name: Install Docker packages
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: present
- name: Enable and start Docker Engine
ansible.builtin.systemd_service:
name: docker
state: started
enabled: true
- name: Verify with Hello World
ansible.builtin.command: docker run hello-world
register: docker_hello
- name: Test
ansible.builtin.debug:
var: docker_hello.stdout_lines