2015-07-28 23:15:19 +08:00
|
|
|
---
|
2016-02-08 05:30:32 +08:00
|
|
|
- name: install pip and docker on ubuntu
|
2015-11-16 18:47:23 +08:00
|
|
|
apt:
|
2016-02-08 05:30:32 +08:00
|
|
|
name: "{{ item }}"
|
2015-11-16 18:47:23 +08:00
|
|
|
state: present
|
2016-02-08 05:30:32 +08:00
|
|
|
update_cache: yes
|
|
|
|
with_items:
|
|
|
|
- python-pip
|
|
|
|
- docker
|
|
|
|
- docker.io
|
|
|
|
when: ansible_distribution == 'Ubuntu'
|
2016-05-06 21:46:58 +08:00
|
|
|
tags:
|
|
|
|
with_pkg
|
2015-11-16 18:47:23 +08:00
|
|
|
|
2016-02-08 05:30:32 +08:00
|
|
|
- name: install pip and docker on debian
|
|
|
|
apt:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
update_cache: yes
|
|
|
|
with_items:
|
|
|
|
- python-pip
|
|
|
|
- docker-engine
|
|
|
|
when: ansible_distribution == 'Debian'
|
2016-05-06 21:46:58 +08:00
|
|
|
tags:
|
|
|
|
with_pkg
|
2016-02-08 05:30:32 +08:00
|
|
|
|
2016-06-03 23:24:00 +08:00
|
|
|
# install epel for pip
|
|
|
|
- name: install epel on redhat
|
|
|
|
yum:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- epel-release
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_pkg_mgr == "yum"
|
|
|
|
tags:
|
|
|
|
with_pkg
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
- name: install pip on redhat
|
2015-11-16 18:47:23 +08:00
|
|
|
yum:
|
2016-02-08 05:30:32 +08:00
|
|
|
name: "{{ item }}"
|
2015-11-16 18:47:23 +08:00
|
|
|
state: present
|
2016-02-08 05:30:32 +08:00
|
|
|
with_items:
|
|
|
|
- python-pip
|
2016-06-03 23:24:00 +08:00
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_pkg_mgr == "yum"
|
|
|
|
tags:
|
|
|
|
with_pkg
|
|
|
|
|
|
|
|
- name: install docker-engine on redhat
|
|
|
|
yum:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
2016-02-08 05:30:32 +08:00
|
|
|
- docker-engine
|
2016-01-29 02:11:22 +08:00
|
|
|
when:
|
2016-05-09 22:08:33 +08:00
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_pkg_mgr == "yum"
|
2016-05-06 21:46:58 +08:00
|
|
|
tags:
|
|
|
|
with_pkg
|
2016-06-03 23:24:00 +08:00
|
|
|
failed_when: false
|
2016-01-29 02:11:22 +08:00
|
|
|
|
2016-06-03 23:24:00 +08:00
|
|
|
# for CentOS
|
|
|
|
- name: install docker on redhat
|
|
|
|
yum:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
|
|
|
with_items:
|
|
|
|
- docker
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_pkg_mgr == "yum"
|
|
|
|
tags:
|
|
|
|
with_pkg
|
|
|
|
failed_when: false
|
|
|
|
|
|
|
|
# docker package could be docker-enginer or docker
|
2016-02-08 05:30:32 +08:00
|
|
|
- name: install pip and docker on redhat
|
2016-01-29 02:11:22 +08:00
|
|
|
dnf:
|
2016-02-08 05:30:32 +08:00
|
|
|
name: "{{ item }}"
|
2016-01-29 02:11:22 +08:00
|
|
|
state: present
|
2016-02-08 05:30:32 +08:00
|
|
|
with_items:
|
|
|
|
- python-pip
|
|
|
|
- docker-engine
|
2016-01-29 02:11:22 +08:00
|
|
|
when:
|
2016-05-09 22:08:33 +08:00
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_pkg_mgr == "dnf"
|
2016-05-06 21:46:58 +08:00
|
|
|
tags:
|
|
|
|
with_pkg
|
2015-11-16 18:47:23 +08:00
|
|
|
|
2016-06-18 00:52:52 +08:00
|
|
|
- name: start docker service
|
|
|
|
service:
|
|
|
|
name: docker
|
|
|
|
state: started
|
|
|
|
enabled: yes
|
|
|
|
tags:
|
|
|
|
with_pkg
|
|
|
|
|
2016-02-10 13:45:17 +08:00
|
|
|
# NOTE (jimcurtis): need at least version 1.9.0 of six or we get:
|
|
|
|
# re:NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined
|
2016-02-05 04:24:56 +08:00
|
|
|
- name: install six
|
|
|
|
pip:
|
|
|
|
name: six
|
|
|
|
version: 1.9.0
|
2016-05-06 21:46:58 +08:00
|
|
|
tags:
|
|
|
|
with_pkg
|
2016-02-05 04:24:56 +08:00
|
|
|
|
2015-07-28 23:15:19 +08:00
|
|
|
# NOTE (leseb): for version 1.1.0 because https://github.com/ansible/ansible-modules-core/issues/1227
|
|
|
|
- name: install docker-py
|
2015-10-19 10:56:02 +08:00
|
|
|
pip:
|
|
|
|
name: docker-py
|
|
|
|
version: 1.1.0
|
2016-05-06 21:46:58 +08:00
|
|
|
tags:
|
|
|
|
with_pkg
|
2016-07-12 20:50:56 +08:00
|
|
|
when: ansible_version['full'] | version_compare('2.1.0.0', '<')
|
2016-07-28 22:42:19 +08:00
|
|
|
|
2016-07-11 17:35:32 +08:00
|
|
|
- name: install docker-py
|
|
|
|
pip:
|
|
|
|
name: docker-py
|
|
|
|
state: latest
|
|
|
|
tags:
|
|
|
|
with_pkg
|
2016-07-12 20:50:56 +08:00
|
|
|
when: ansible_version['full'] | version_compare('2.1.0.0', '>=')
|
2016-07-11 17:35:32 +08:00
|
|
|
|
2016-07-28 22:42:19 +08:00
|
|
|
- name: install ntp on redhat using yum
|
|
|
|
yum:
|
|
|
|
name: ntp
|
|
|
|
state: present
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_pkg_mgr == 'yum'
|
|
|
|
- ntp_service_enabled
|
|
|
|
tags:
|
|
|
|
with_pkg
|
|
|
|
|
|
|
|
- name: install ntp on redhat using dnf
|
|
|
|
dnf:
|
|
|
|
name: ntp
|
|
|
|
state: present
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'RedHat'
|
|
|
|
- ansible_pkg_mgr == 'dnf'
|
|
|
|
- ntp_service_enabled
|
|
|
|
tags:
|
|
|
|
with_pkg
|
|
|
|
|
|
|
|
- name: install ntp on debian
|
|
|
|
apt:
|
|
|
|
name: ntp
|
|
|
|
state: present
|
|
|
|
when:
|
|
|
|
- ansible_os_family == 'Debian'
|
|
|
|
- ntp_service_enabled
|
|
|
|
tags:
|
|
|
|
with_pkg
|