summaryrefslogtreecommitdiff
path: root/ansible/roles/trove-setup/tasks/gitano-worker-setup.yml
blob: e0510e4b166f05c794956bf517dd3073f5e67ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Depends on:
# - gitano-setup.yml
---
- name: Check if worker has a sshkey configured in gitano (This task can fail)
  shell: su git -c 'ssh git@localhost as distbuild sshkey' 2>&1 | grep WARNING
  register: gitano_worker_key
  changed_when: False
  ignore_errors: True
# If distbuild user doesn't have an sshkey configured
- name: Create /home/git/keys/ to store ssh keys
  file: path=/home/git/keys state=directory owner=git group=git
  when: gitano_worker_key|success
- name: Copy WORKER_SSH_PUBKEY to /home/git/keys/worker.key.pub
  copy: src={{ WORKER_SSH_PUBKEY }} dest=/home/git/keys/worker.key.pub mode=0644
  when: gitano_worker_key|success
- name: Add /home/git/keys/worker.key.pub to the distbuild user in Gitano
  shell: su git -c 'ssh git@localhost as distbuild sshkey add trove < /home/git/keys/worker.key.pub'
  when: gitano_worker_key|success