summaryrefslogtreecommitdiff
path: root/ansible/roles/trove-setup/tasks/gitano-lorry-setup.yml
blob: d52927a8f9a8194f7b9f284b1ae5d03b6d285510 (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 lorry has a sshkey configured in gitano (This task can fail)
  shell: su git -c 'ssh git@localhost as lorry sshkey' 2>&1 | grep WARNING
  register: gitano_lorry_key
  changed_when: False
  ignore_errors: True
# If lorry user doesn't have an sshkey configured
- name: Create /home/git/keys folder to store ssh keys
  file: path=/home/git/keys state=directory owner=git group=git
  when: gitano_lorry_key|success
- name: Copy LORRY_SSH_PUBKEY to /home/git/keys/lorry.key.pub
  copy: src={{ LORRY_SSH_PUBKEY }} dest=/home/git/keys/lorry.key.pub mode=0644
  when: gitano_lorry_key|success
- name: Add to the gitano lorry user the /home/git/keys/lorry.key.pub
  shell: su git -c 'ssh git@localhost as lorry sshkey add trove < /home/git/keys/lorry.key.pub'
  when: gitano_lorry_key|success