From ce11216a0ee43cc623c1a33d1b1b0f78097d2745 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Thu, 29 Sep 2016 16:17:48 +0200 Subject: [PATCH] Improve playbook to setup gate nodes * use become instead of sudo * use file instead of shell to change file modes * rename setup_nodes.yml to playbook-setup-nodes.yml Change-Id: I69eda1f034b97d13be76efc91458b6d762c76baf --- .../{setup_nodes.yml => playbook-setup-nodes.yml} | 14 ++++++++++---- tools/setup_gate.sh | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) rename tools/{setup_nodes.yml => playbook-setup-nodes.yml} (76%) diff --git a/tools/setup_nodes.yml b/tools/playbook-setup-nodes.yml similarity index 76% rename from tools/setup_nodes.yml rename to tools/playbook-setup-nodes.yml index b61f126dfa..19bdf56b48 100644 --- a/tools/setup_nodes.yml +++ b/tools/playbook-setup-nodes.yml @@ -1,6 +1,7 @@ --- - hosts: all - sudo: yes + become: true + tasks: - name: Setup /etc/hosts copy: @@ -22,14 +23,19 @@ mode: 0755 - hosts: all + become: true + tasks: - name: Create log directory for node file: state: directory path: /tmp/{{ inventory_hostname }} + become: false - name: Run node setup - shell: sudo /tmp/setup.sh + shell: /tmp/setup.sh - - name: Changing permissions of docker socket to 666 - shell: sudo chmod 0666 /run/docker.sock + - name: Changing permissions of Docker socket to 666 + file: + path: /run/docker.sock + mode: 0666 diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh index 47fcadce25..e0cf527647 100755 --- a/tools/setup_gate.sh +++ b/tools/setup_gate.sh @@ -132,7 +132,7 @@ EOF } function setup_node { - ansible-playbook -i ${RAW_INVENTORY} tools/setup_nodes.yml + ansible-playbook -i ${RAW_INVENTORY} tools/playbook-setup-nodes.yml } function setup_logging {