2017-07-31 20:07:30 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Ensure Docker repository is enabled (CentOS)
|
|
|
|
template:
|
|
|
|
src: "{{ role_path }}/files/yum.repos.d/{{ item }}"
|
|
|
|
dest: "/etc/yum.repos.d/{{ item }}"
|
|
|
|
owner: "root"
|
|
|
|
group: "root"
|
|
|
|
mode: 0644
|
|
|
|
with_items:
|
|
|
|
- docker-ce.repo
|
|
|
|
when: ansible_distribution == 'CentOS'
|
|
|
|
|
|
|
|
- name: Ensure Docker's RPM key is trusted
|
|
|
|
rpm_key:
|
|
|
|
state: present
|
|
|
|
key: https://download.docker.com/linux/centos/gpg
|
|
|
|
when: ansible_distribution == 'CentOS'
|
|
|
|
|
2017-09-11 20:24:05 +00:00
|
|
|
- name: Ensure yum packages are installed (CentOS)
|
2018-10-12 06:00:50 +00:00
|
|
|
yum:
|
|
|
|
name:
|
|
|
|
- bash-completion
|
|
|
|
- docker-ce
|
|
|
|
- docker-python
|
|
|
|
- ntp
|
|
|
|
- fuse
|
|
|
|
state: latest
|
|
|
|
update_cache: yes
|
2017-07-31 20:07:30 +00:00
|
|
|
when: ansible_distribution == 'CentOS'
|
|
|
|
|
2017-09-11 20:24:05 +00:00
|
|
|
- name: Ensure APT usage dependencies are installed (Debian)
|
|
|
|
apt:
|
2018-10-12 06:00:50 +00:00
|
|
|
name:
|
|
|
|
- apt-transport-https
|
|
|
|
- ca-certificates
|
2017-09-11 20:24:05 +00:00
|
|
|
state: present
|
|
|
|
update_cache: yes
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
2019-11-15 20:56:42 +00:00
|
|
|
- name: Gather package facts (Debian)
|
|
|
|
package_facts:
|
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
2017-09-11 20:24:05 +00:00
|
|
|
- name: Ensure Docker's APT key is trusted (Debian)
|
|
|
|
apt_key:
|
|
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
|
|
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
|
|
|
state: present
|
|
|
|
register: add_repository_key
|
|
|
|
ignore_errors: true
|
2019-11-15 20:56:42 +00:00
|
|
|
when: ansible_os_family == 'Debian' and 'docker.io' not in ansible_facts.packages
|
2017-09-11 20:24:05 +00:00
|
|
|
|
|
|
|
- name: Ensure Docker repository is enabled (Debian)
|
|
|
|
apt_repository:
|
2019-07-26 19:43:35 +00:00
|
|
|
repo: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
|
2017-09-11 20:24:05 +00:00
|
|
|
state: present
|
|
|
|
update_cache: yes
|
2019-11-15 20:56:42 +00:00
|
|
|
when: ansible_os_family == 'Debian' and 'docker.io' not in ansible_facts.packages
|
2017-09-11 20:24:05 +00:00
|
|
|
|
|
|
|
- name: Ensure APT packages are installed (Debian)
|
2018-10-12 06:00:50 +00:00
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- bash-completion
|
|
|
|
- python-docker
|
|
|
|
- ntp
|
|
|
|
- fuse
|
|
|
|
state: latest
|
|
|
|
update_cache: yes
|
2017-09-11 20:24:05 +00:00
|
|
|
when: ansible_os_family == 'Debian'
|
|
|
|
|
2019-11-15 20:56:42 +00:00
|
|
|
- name: Ensure docker-ce is installed (Debian)
|
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- docker-ce
|
|
|
|
state: latest
|
|
|
|
update_cache: yes
|
2019-11-16 13:53:42 +00:00
|
|
|
when: ansible_os_family == 'Debian' and 'docker.io' not in ansible_facts.packages
|
2019-11-15 20:56:42 +00:00
|
|
|
|
2017-08-08 11:29:14 +00:00
|
|
|
- name: Ensure Docker is started and autoruns
|
2019-01-07 22:35:35 +00:00
|
|
|
service:
|
2019-04-30 13:30:26 +00:00
|
|
|
name: docker
|
2019-01-07 22:35:35 +00:00
|
|
|
state: started
|
|
|
|
enabled: yes
|
2017-08-08 11:29:14 +00:00
|
|
|
|
2017-07-31 20:07:30 +00:00
|
|
|
- name: Ensure ntpd is started and autoruns
|
2017-09-11 20:24:05 +00:00
|
|
|
service:
|
|
|
|
name: "{{ 'ntpd' if ansible_os_family == 'RedHat' else 'ntp' }}"
|
|
|
|
state: started
|
|
|
|
enabled: yes
|