Skip to content

Commit

Permalink
Merge pull request #69 from mrsheepuk/DockerConfigSystemD
Browse files Browse the repository at this point in the history
Support for DOCKER_OPTS on Ubuntu 15.04
  • Loading branch information
angstwad committed Oct 3, 2015
2 parents a4188ac + 77a275e commit 4248df4
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
6 changes: 6 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@
- name: Reload docker
service: name=docker state=reloaded

- name: Reload systemd
command: systemctl daemon-reload

- name: Restart docker
service: name=docker state=restarted

- name: Restart dockerio
service: name=docker.io state=restarted
35 changes: 34 additions & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,40 @@
mode: 0644
notify:
- Reload docker
when: docker_opts != ""
when: docker_opts != "" and ansible_distribution_version|version_compare(15.04, '<')

- name: Create systemd configuration directory for Docker service (systemd)
file:
dest: /etc/systemd/system/docker.service.d
state: directory
owner: root
group: root
mode: 0755
when: docker_opts != "" and ansible_distribution_version|version_compare(15.04, '>=')

- name: Set docker daemon options (systemd)
copy:
content: |
[Service]
Environment="DOCKER_OPTS={{ docker_opts.rstrip('\n') }}"
dest: /etc/systemd/system/docker.service.d/env.conf
owner: root
group: root
mode: 0644
notify:
- Reload systemd
- Restart docker
when: docker_opts != "" and ansible_distribution_version|version_compare(15.04, '>=')

- name: Ensure docker daemon options used (systemd)
lineinfile:
dest: /lib/systemd/system/docker.service
regexp: "ExecStart=/usr/bin/docker daemon -H fd://"
line: ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS
notify:
- Reload systemd
- Restart docker
when: docker_opts != "" and ansible_distribution_version|version_compare(15.04, '>=')

- name: Fix DNS in docker.io
lineinfile:
Expand Down

0 comments on commit 4248df4

Please sign in to comment.