Use ansible galaxy to install docker
This commit is contained in:
parent
1af9fd508f
commit
85f6f59970
6 changed files with 15 additions and 21 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -113,6 +113,7 @@ dmypy.json
|
||||||
# End of https://www.gitignore.io/api/python,ansible
|
# End of https://www.gitignore.io/api/python,ansible
|
||||||
env/
|
env/
|
||||||
ansible/.vault_pass
|
ansible/.vault_pass
|
||||||
|
ansible/galaxy_roles
|
||||||
|
|
||||||
# Created by https://www.gitignore.io/api/terraform
|
# Created by https://www.gitignore.io/api/terraform
|
||||||
# Edit at https://www.gitignore.io/?templates=terraform
|
# Edit at https://www.gitignore.io/?templates=terraform
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
nocows = 1
|
nocows = 1
|
||||||
host_key_checking = False
|
host_key_checking = False
|
||||||
retry_files_enabled = False
|
retry_files_enabled = False
|
||||||
|
roles_path = $PWD/galaxy_roles:$PWD/roles
|
||||||
inventory = ./hosts
|
inventory = ./hosts
|
||||||
become_ask_pass = True
|
become_ask_pass = True
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,10 @@
|
||||||
- hosts: intersect
|
- hosts: intersect
|
||||||
roles:
|
roles:
|
||||||
- ssh
|
- ssh
|
||||||
|
- role: geerlingguy.docker
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
docker_install_compose: false # This role installs the binary directly, which is kinda nasty
|
||||||
|
docker_users:
|
||||||
|
- "{{ user }}"
|
||||||
- docker
|
- docker
|
||||||
|
|
1
ansible/requirements.yaml
Normal file
1
ansible/requirements.yaml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
- src: geerlingguy.docker
|
|
@ -1,27 +1,8 @@
|
||||||
- name: Add docker apt key
|
- name: Install docker-compose
|
||||||
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:
|
apt:
|
||||||
name: "{{ item }}"
|
name: "docker-compose"
|
||||||
become: true
|
become: true
|
||||||
become_user: root
|
become_user: root
|
||||||
loop:
|
|
||||||
- docker-ce
|
|
||||||
- docker-ce-cli
|
|
||||||
- containerd.io
|
|
||||||
- docker-compose
|
|
||||||
|
|
||||||
- name: Create docker user
|
- name: Create docker user
|
||||||
user:
|
user:
|
||||||
|
|
|
@ -5,3 +5,7 @@ set -ex
|
||||||
python -m venv env
|
python -m venv env
|
||||||
|
|
||||||
env/bin/pip install -r dev-requirements.txt
|
env/bin/pip install -r dev-requirements.txt
|
||||||
|
|
||||||
|
cd ansible/
|
||||||
|
|
||||||
|
../env/bin/ansible-galaxy install -r requirements.yaml
|
||||||
|
|
Loading…
Reference in a new issue