Skip to content

Commit

Permalink
Only install github key when found
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Nov 27, 2024
1 parent 0bba22d commit 48e7362
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion roles/api/tasks/credentials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@
when:
- "semaphore_keystores.json | selectattr('name', 'equalto', 'Controller-ssh-key') | length == 0"

- name: "Semaphore | Read ssh key from system"
- name: "Read ssh key from system"
delegate_to: localhost
connection: local
become: false
no_log: "{{ not debug }}"
ansible.builtin.slurp:
path: "{{ my_github_key }}"
register: "ssh_key_github"
failed_when: false

- name: "Create SSH key for GitHub"
changed_when: "semaphore_key_github_created.status == 204"
Expand All @@ -78,4 +79,5 @@
timeout: 5
register: semaphore_key_github_created
when:
- "'file not found' not in ssh_key_github.msg"
- "semaphore_keystores.json | selectattr('name', 'equalto', 'github-ssh-key') | length == 0"

0 comments on commit 48e7362

Please sign in to comment.