You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
---
|
|
- name: Install python-apt to use ansible apt module
|
|
shell: apt update && apt install -y python-apt
|
|
|
|
- name: Ensure python and other dependencies are installed.
|
|
apt:
|
|
name:
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- gnupg
|
|
- python-pip
|
|
#- python-docker
|
|
state: present
|
|
|
|
- name: pip install docker
|
|
pip:
|
|
name: docker
|
|
state: present
|
|
|
|
- name: Add docker gpg key
|
|
#shell: wget https://download.docker.com/linux/debian/gpg -O - | apt-key add -
|
|
apt_key:
|
|
url: "https://download.docker.com/linux/debian/gpg"
|
|
state: present
|
|
|
|
- name: Add docker stable repository for debian
|
|
apt_repository:
|
|
repo: "deb https://download.docker.com/linux/debian stretch stable"
|
|
state: present
|
|
|
|
- name: Install lxc & docker
|
|
apt:
|
|
name:
|
|
- lxc
|
|
- docker
|
|
- docker-ce
|
|
- python-lxc
|
|
when: inventory_hostname in groups['manager']
|
|
|
|
- name: Install docker on worker nodes
|
|
apt:
|
|
name:
|
|
- docker-ce
|
|
when: inventory_hostname in groups['workers']
|
|
|
|
- name: Fix docker module missing issue
|
|
command: touch /.dockerenv
|
|
run_once: true
|
|
when: inventory_hostname in groups['workers']
|
|
notify: Restart docker
|
|
|