44 lines
948 B
YAML
44 lines
948 B
YAML
- name: Add docker apt key
|
|
apt_key:
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
state: present
|
|
become: true
|
|
become_user: root
|
|
|
|
- name: Add docker repo
|
|
apt_repository:
|
|
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
|
|
state: present
|
|
become: true
|
|
become_user: root
|
|
|
|
- name: Install Docker and docker-compose
|
|
apt:
|
|
name: "{{ item }}"
|
|
become: true
|
|
become_user: root
|
|
loop:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|
|
- docker-compose
|
|
|
|
- name: Create docker user
|
|
user:
|
|
name: "{{ docker_user.name }}"
|
|
uid: "{{ docker_user.id }}"
|
|
group: "{{ docker_user.name }}"
|
|
create_home: false
|
|
|
|
- name: Clean up docker containers
|
|
cron:
|
|
name: clean up docker containers
|
|
special_time: weekly
|
|
job: "docker system prune"
|
|
|
|
- name: Install util scripts
|
|
copy:
|
|
src: ./files/docker-utils
|
|
dest: "{{ home }}"
|
|
mode: 0755
|
|
directory_mode: 0755
|