Only run once our delegate_to locahost commands

In a multi node setup, we only want this logic to be run one across
all hosts.

Change-Id: I4ebb62f76d4ff7363635bee7073c2d7e8f0ad70e
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-07-21 16:21:13 -04:00
parent 68ee0780be
commit bbc4c5b920
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
2 changed files with 4 additions and 0 deletions

View File

@ -1,6 +1,7 @@
- name: Create Temp SSH key - name: Create Temp SSH key
command: ssh-keygen -t rsa -b 1024 -N '' -f {{ zuul_temp_ssh_key }} command: ssh-keygen -t rsa -b 1024 -N '' -f {{ zuul_temp_ssh_key }}
delegate_to: localhost delegate_to: localhost
run_once: true
- name: Distribute it to all nodes - name: Distribute it to all nodes
authorized_key: authorized_key:
@ -11,10 +12,12 @@
- name: Remove all keys from local agent - name: Remove all keys from local agent
command: ssh-add -D command: ssh-add -D
delegate_to: localhost delegate_to: localhost
run_once: true
- name: Add back temp key - name: Add back temp key
command: ssh-add {{ zuul_temp_ssh_key }} command: ssh-add {{ zuul_temp_ssh_key }}
delegate_to: localhost delegate_to: localhost
run_once: true
- name: Verify we can still SSH to all nodes - name: Verify we can still SSH to all nodes
ping: ping:

View File

@ -3,6 +3,7 @@
path: "{{ zuul_temp_ssh_key }}" path: "{{ zuul_temp_ssh_key }}"
register: zuul_temp_ssh_key_stat register: zuul_temp_ssh_key_stat
delegate_to: localhost delegate_to: localhost
run_once: true
failed_when: false failed_when: false
- name: Create a new key in workspace based on build UUID - name: Create a new key in workspace based on build UUID