-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.yml
39 lines (29 loc) · 1.58 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
- set_fact: docker_package=docker.io
when: ansible_distribution_major_version == '14' and ansible_distribution == 'Ubuntu'
- set_fact: docker_package=lxc-docker
when: ansible_distribution_major_version == '12' and ansible_distribution == 'Ubuntu'
- set_fact: docker_default=/etc/default/{{ docker_package }}
when: ansible_distribution_major_version == '14' and ansible_distribution == 'Ubuntu'
- set_fact: docker_default=/etc/default/docker
when: ansible_distribution_major_version == '12' and ansible_distribution == 'Ubuntu'
- name: install docker
apt: pkg={{ docker_package }} state=installed
- name: Check Docker existence
stat: path={{ docker_default }}
register: docker_default_file
- name: Check Docker Custom Opts existence
stat: path=/etc/default/docker.ext
register: docker_ext_default_file
- name: Configuring DOCKER_OPTS for DOCKER HOST - key requirement for Shipyard server
when: docker_default_file.stat.exists and docker_ext_default_file.stat.exists == False
shell: echo ". /etc/default/docker.ext" >> /etc/default/{{ docker_package }}
- name: Creating extended DOCKER_OPTS
when: ansible_distribution == 'Ubuntu' and docker_default_file.stat.exists
template: src=docker.ext.j2 dest=/etc/default/docker.ext
register: docker_host
notify: restart docker
- name: wait for docker on private ip port 4243
wait_for: port=4243 delay=15 host={{ ansible_default_ipv4.address }}
when: docker_host.changed
- debug: msg="docker is up and listening on port 4243"