Skip to content

Commit

Permalink
Force restarts for systemd services
Browse files Browse the repository at this point in the history
  • Loading branch information
drmalex07 committed Sep 13, 2017
1 parent 1f65c19 commit 189511b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion install-ansible-prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#

if [ ! -f ~/.ansible-prereqs-installed ]; then
apt-get install -y python
apt-get install -y python sudo
[ "$?" -eq 0 ] && touch ~/.ansible-prereqs-installed
fi
8 changes: 5 additions & 3 deletions play.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@

tasks:

- debug: var=play_hosts

#- debug: var=play_hosts
#- debug: var=network
#- debug: var=hostname

Expand All @@ -64,11 +63,12 @@
tasks:

- name: Reboot for group membership to be re-evaluated
shell: reboot
shell: sleep 2 && reboot
sudo: yes
async: 30
poll: 0
ignore_errors: true
tags: ['reboot']

- name: Wait for play hosts to be up again
wait_for:
Expand All @@ -79,9 +79,11 @@
timeout: 40
with_items: '{{play_hosts}}'
connection: local
tags: ['reboot']

- name:
shell: uptime
tags: ['reboot']

#
# 3. Initialize manager as a swarm manager node
Expand Down
2 changes: 0 additions & 2 deletions roles/docker-engine/tasks/configure-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
dest: /etc/systemd/system/docker.socket.d/10-socket.conf
mode: 0600
when: listen_address is defined
notify:
- 'restart-docker'
sudo: yes
sudo_user: root

Expand Down
5 changes: 0 additions & 5 deletions roles/docker-engine/tasks/install-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
apt: pkg=docker-ce state=latest
sudo: yes
sudo_user: root

- name: Run a hello-world Docker container
shell: docker run --rm hello-world
sudo: yes
sudo_user: root

- name: Download docker-compose binary
get_url:
Expand Down
14 changes: 13 additions & 1 deletion roles/docker-engine/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
- include: install-docker.yml

- include: configure-docker.yml

- name: Restart docker sockets
systemd:
name: docker.socket
daemon_reload: yes
state: restarted
sudo: yes
sudo_user: root

- name: Run a hello-world Docker container
shell: docker run --rm hello-world
sudo: yes
sudo_user: root

- name: Add user to docker group
user:
Expand All @@ -23,4 +36,3 @@
path: ~/bin
state: directory


0 comments on commit 189511b

Please sign in to comment.