Setup and install docker
This commit is contained in:
parent
d61cb64c7e
commit
9d8e7cbc9c
4 changed files with 40 additions and 0 deletions
|
@ -10,3 +10,4 @@
|
|||
- hosts: intersect
|
||||
roles:
|
||||
- ssh
|
||||
- docker
|
||||
|
|
5
ansible/roles/docker/tasks/main.yml
Normal file
5
ansible/roles/docker/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- name: Include docker variables
|
||||
include_vars: docker.yml
|
||||
|
||||
- name: Install Docker
|
||||
include: setup-docker.yml
|
31
ansible/roles/docker/tasks/setup-docker.yml
Normal file
31
ansible/roles/docker/tasks/setup-docker.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
- name: Add an Apt signing key, uses whichever key is at the URL
|
||||
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
|
3
ansible/roles/docker/vars/docker.yml
Normal file
3
ansible/roles/docker/vars/docker.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
docker_user:
|
||||
id: 3000
|
||||
name: dockeruser
|
Loading…
Reference in a new issue