mirror of
https://github.com/fscotto/infra.git
synced 2026-05-31 07:49:57 +00:00
75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
---
|
|
- name: Ensure Docker apt keyrings directory exists
|
|
tags: [packages]
|
|
ansible.builtin.file:
|
|
path: /etc/apt/keyrings
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
when: ubuntu_manage_docker_repo | default(false)
|
|
|
|
- name: Download Docker apt repository signing key
|
|
tags: [packages]
|
|
ansible.builtin.get_url:
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
dest: /etc/apt/keyrings/docker.asc
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
when: ubuntu_manage_docker_repo | default(false)
|
|
|
|
- name: Configure Docker apt repository
|
|
tags: [packages]
|
|
ansible.builtin.apt_repository:
|
|
repo: >-
|
|
deb [arch={{ 'amd64' if ansible_facts['architecture'] == 'x86_64'
|
|
else 'arm64' if ansible_facts['architecture'] in ['aarch64', 'arm64']
|
|
else ansible_facts['architecture'] }}
|
|
signed-by=/etc/apt/keyrings/docker.asc]
|
|
https://download.docker.com/linux/ubuntu
|
|
{{ ansible_facts['distribution_release'] }} stable
|
|
filename: docker
|
|
state: present
|
|
update_cache: true
|
|
when: ubuntu_manage_docker_repo | default(false)
|
|
|
|
- name: Refresh apt package cache
|
|
tags: [packages]
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
|
|
- name: Install packages on Ubuntu
|
|
tags: [packages]
|
|
ansible.builtin.apt:
|
|
name: >-
|
|
{{
|
|
(common_packages | default([]))
|
|
+ (ubuntu_packages_base | default([]))
|
|
+ (ubuntu_docker_packages | default([]))
|
|
+ (profile_packages | default([]))
|
|
+ (host_packages | default([]))
|
|
}}
|
|
state: present
|
|
|
|
- name: Add user to docker group
|
|
tags: [packages]
|
|
ansible.builtin.user:
|
|
name: "{{ username }}"
|
|
groups: docker
|
|
append: true
|
|
when: (ubuntu_docker_packages | default([])) | length > 0
|
|
|
|
- name: Install workstation snap packages
|
|
tags: [packages]
|
|
community.general.snap:
|
|
name: "{{ item.name }}"
|
|
classic: "{{ item.classic | default(false) }}"
|
|
channel: "{{ item.channel | default(omit) }}"
|
|
state: present
|
|
loop: "{{ workstation_snap_packages | default([]) }}"
|
|
loop_control:
|
|
label: "{{ item.name }}"
|
|
when: (workstation_snap_packages | default([])) | length > 0
|