-
Notifications
You must be signed in to change notification settings - Fork 47
Use a template to generate docker.list #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ludovicc
wants to merge
26
commits into
AnsibleShipyard:master
Choose a base branch
from
ludovicc:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+214
−43
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9575f45
Use a template to generate docker.list
ludovicc 4c1b443
Quote DOCKER_OPTS
ludovicc af49150
Add Vagrantfile and tests
ludovicc 56b29fb
Attempt to please Travis CI
ludovicc c931eb2
Use apt-key
bc45209
More efficient installation of Docker
ludovicc b99008f
Fix repo var
ludovicc e987995
Fix repo var take 2
ludovicc 596f7ee
Fix runlevel to start Docker on startup
ludovicc f523b9c
Configure systemd
ludovicc b46c9e1
Use proper name for new package
028690f
Mark tasks without side effects
da1c96b
Typo
ludovicc 60f56c1
Add missing check
ludovicc 15937cb
Fix version of Docker
ludovicc 57cf208
Merge remote-tracking branch 'upstream/master'
ludovicc 44ed971
Use init script from Docker 1.9.1
ludovicc b9ee360
Avoid spurious detection of systemd on Ubuntu 14.04.3
ludovicc 5c98925
Align start trigger with the latest Docker engine
ludovicc 85a841a
Merge remote-tracking branch 'upstream/master' into upstream
ludovicc 7505e3b
Merge branch 'master' of github.com:ludovicc/ansible-docker
ludovicc 498fc8e
Docker 1.10 now uses a daemon command instead of -d flag
ludovicc 3737bf1
Don't always update apt cache
58218fe
Fix configuration under systemd
ludovicc 9f925de
Cleanup deprecation warning
ludovicc 95edfc8
New naming convension for Docker versions
ludovicc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1 @@ | ||
| .vagrant | ||
|
|
||
| .vagrant/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
|
|
||
| - hosts: localhost | ||
| connection: local | ||
| sudo: yes | ||
| become: yes | ||
|
|
||
| roles: | ||
| - {role: ../../} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,19 @@ | ||
| --- | ||
| - name: Restart Docker | ||
| service: name=docker state=restarted enabled=yes sleep=5 | ||
| - name: restart docker | ||
| become: yes | ||
| service: | ||
| name: docker | ||
| state: restarted | ||
| sleep: 5 | ||
|
|
||
| - name: restart rsyslog | ||
| become: yes | ||
| service: | ||
| name: rsyslog | ||
| state: restarted | ||
|
|
||
| - name: reload docker | ||
| become: yes | ||
| command: systemctl daemon-reload | ||
| notify: | ||
| - restart docker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
|
|
||
| - name: Install Docker Repository | ||
| template: src=docker-repo.j2 dest=/etc/yum.repos.d/docker.repo | ||
|
|
||
| - name: Install Docker Engine | ||
| yum: name=docker-engine state=present | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,97 @@ | ||
|
|
||
| - name: create rsyslog.d | ||
| become: yes | ||
| file: | ||
| dest: /etc/rsyslog.d | ||
| state: directory | ||
| tags: | ||
| - docker | ||
| - bootstrap | ||
|
|
||
| - name: create docker entry for syslogd | ||
| become: yes | ||
| copy: | ||
| dest: /etc/rsyslog.d/10-docker.conf | ||
| content: | | ||
| # Docker logging | ||
| :syslogtag, isequal, "docker:" /var/log/docker/docker.log | ||
| & ~ | ||
| notify: | ||
| - restart rsyslog | ||
| tags: | ||
| - docker | ||
| - bootstrap | ||
|
|
||
| - name: Check if /etc/init exists | ||
| stat: path=/etc/init/ | ||
| register: etc_init | ||
|
|
||
| - name: Check if systemd exists | ||
| stat: path=/bin/systemctl | ||
| register: systemd_check | ||
|
|
||
| - name: Docker upstart default config file | ||
| template: src=docker-defaults.j2 dest=/etc/default/docker | ||
| when: etc_init.stat.exists == true | ||
| notify: | ||
| - Restart Docker | ||
| when: etc_init.stat.exists == true and systemd_check.stat.exists == false | ||
| notify: | ||
| - restart docker | ||
|
|
||
| - name: Docker init file | ||
| template: src=docker-init.j2 dest=/etc/init/docker.conf | ||
| when: etc_init.stat.exists == true | ||
| notify: | ||
| - Restart Docker | ||
| when: etc_init.stat.exists == true and systemd_check.stat.exists == false | ||
| notify: | ||
| - restart docker | ||
|
|
||
| - name: Check if systemd exists | ||
| stat: path=/usr/lib/systemd/system/ | ||
| register: systemd_check | ||
| - name: create /etc/sysconfig | ||
| become: yes | ||
| file: | ||
| dest: /etc/sysconfig | ||
| state: directory | ||
| tags: | ||
| - docker | ||
|
|
||
| - name: Docker systemd default config file | ||
| template: src=docker-sysconfig.j2 dest=/etc/sysconfig/docker | ||
| when: systemd_check.stat.exists == true | ||
| notify: | ||
| - Restart Docker | ||
| notify: | ||
| - restart docker | ||
|
|
||
| - name: Docker systemd file | ||
| template: src=docker-service.j2 dest=/lib/systemd/system/docker.service backup=yes | ||
| when: systemd_check.stat.exists == true | ||
| notify: | ||
| - Restart Docker | ||
| notify: | ||
| - reload docker | ||
| - restart docker | ||
|
|
||
| - name: create docker.system.d | ||
| become: yes | ||
| file: | ||
| dest: /etc/systemd/system/docker.service.d | ||
| state: directory | ||
| tags: | ||
| - docker | ||
|
|
||
| - name: create local docker service override | ||
| become: yes | ||
| copy: | ||
| dest: /etc/systemd/system/docker.service.d/local.conf | ||
| content: | | ||
| [Service] | ||
| EnvironmentFile=-/etc/sysconfig/docker | ||
| ExecStart= | ||
| ExecStart=/usr/bin/docker daemon -H fd:// $other_arg | ||
| when: systemd_check.stat.exists == true | ||
| notify: | ||
| - reload docker | ||
| tags: | ||
| - docker | ||
|
|
||
| - name: enable docker | ||
| become: yes | ||
| service: | ||
| name: docker | ||
| enabled: yes | ||
| state: started | ||
| tags: | ||
| - docker | ||
| - bootstrap # needed to install Docker images during bootstrap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| # Generated by Ansible for {{ansible_fqdn}} | ||
|
|
||
| DOCKER_OPTS={{docker_opts}} | ||
| DOCKER_OPTS="{{docker_opts}}" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,62 @@ | ||
| # Generated by Ansible for {{ansible_fqdn}} | ||
|
|
||
| description "Docker daemon" | ||
|
|
||
| start on filesystem | ||
| start on (filesystem and net-device-up IFACE!=lo) | ||
| stop on runlevel [!2345] | ||
| limit nofile 524288 1048576 | ||
| limit nproc 524288 1048576 | ||
|
|
||
| respawn | ||
|
|
||
| kill timeout 20 | ||
|
|
||
| pre-start script | ||
| # see also https://github.com/tianon/cgroupfs-mount/blob/master/cgroupfs-mount | ||
| if grep -v '^#' /etc/fstab | grep -q cgroup \ | ||
| || [ ! -e /proc/cgroups ] \ | ||
| || [ ! -d /sys/fs/cgroup ]; then | ||
| exit 0 | ||
| fi | ||
| if ! mountpoint -q /sys/fs/cgroup; then | ||
| mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup | ||
| fi | ||
| ( | ||
| cd /sys/fs/cgroup | ||
| for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do | ||
| mkdir -p $sys | ||
| if ! mountpoint -q $sys; then | ||
| if ! mount -n -t cgroup -o $sys cgroup $sys; then | ||
| rmdir $sys || true | ||
| fi | ||
| fi | ||
| done | ||
| ) | ||
| end script | ||
|
|
||
| script | ||
| [ ! -f /etc/default/docker ] || . /etc/default/docker | ||
| /usr/bin/docker -d $DOCKER_OPTS | ||
| # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) | ||
| DOCKER=/usr/bin/$UPSTART_JOB | ||
| DOCKER_OPTS= | ||
| if [ -f /etc/default/$UPSTART_JOB ]; then | ||
| . /etc/default/$UPSTART_JOB | ||
| fi | ||
| exec "$DOCKER" daemon $DOCKER_OPTS | ||
| end script | ||
|
|
||
| # Don't emit "started" event until docker.sock is ready. | ||
| # See https://github.com/docker/docker/issues/6647 | ||
| post-start script | ||
| DOCKER_OPTS= | ||
| if [ -f /etc/default/$UPSTART_JOB ]; then | ||
| . /etc/default/$UPSTART_JOB | ||
| fi | ||
| if ! printf "%s" "$DOCKER_OPTS" | grep -qE -e '-H|--host'; then | ||
| while ! [ -e /var/run/docker.sock ]; do | ||
| initctl status $UPSTART_JOB | grep -qE "(stop|respawn)/" && exit 1 | ||
| echo "Waiting for /var/run/docker.sock" | ||
| sleep 0.1 | ||
| done | ||
| echo "/var/run/docker.sock is up" | ||
| fi | ||
| end script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,3 @@ | ||
| # {{ansible_managed}} | ||
|
|
||
| OPTIONS={{docker_opts}} | ||
|
|
||
| # CentOS 6, RHEL 6 | ||
| other_args={{docker_opts}} | ||
| other_arg='{{docker_opts}}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [local] | ||
| localhost | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
|
|
||
| - hosts: localhost | ||
| connection: local | ||
| become: yes | ||
|
|
||
| tasks: | ||
| - name: Wait for Docker to be up | ||
| wait_for: path=/var/run/docker.sock state=started delay=3 timeout=5 | ||
|
|
||
| - name: Test that Docker can run hello-world | ||
| command: docker run --rm hello-world | ||
| register: status | ||
| failed_when: status.rc != 0 | ||
| changed_when: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| # | ||
| # Test Playbook | ||
| # | ||
|
|
||
| - hosts: localhost | ||
| connection: local | ||
| become: yes | ||
|
|
||
| roles: | ||
| - {role: ../../} | ||
|
|
||
| - include: main.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| # replace with gist variant | ||
| docker_repo_key: "36A1D7869245C8950F966E92D8576A8BA88D21E9" | ||
| docker_repo: "https://get.docker.io/ubuntu" | ||
| docker_repo_key: "58118E89F3A912897C070ADBF76221572C52609D" | ||
| docker_repo: "https://apt.dockerproject.org/repo" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already an
ci/folder for testing, why adding this one or not removing the other ?