mirror of
https://github.com/ublue-os/forge.git
synced 2025-07-07 10:15:44 +03:00
feat: automatically setup forge (#10)
This commit is contained in:
parent
c694947618
commit
bbe78ee922
28 changed files with 1472 additions and 0 deletions
40
setup/ansible/roles/semaphore/tasks/keys.yml
Normal file
40
setup/ansible/roles/semaphore/tasks/keys.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
- name: Check for existing keystore
|
||||
changed_when: false
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ ansible_host }}:3000/api/project/{{ semaphore_project_id }}/keys"
|
||||
method: GET
|
||||
headers:
|
||||
Cookie: "{{ semaphore_login.cookies_string }}"
|
||||
status_code: 200
|
||||
timeout: 5
|
||||
register: semaphore_keystores
|
||||
|
||||
- name: Create key of type None
|
||||
changed_when: "semaphore_key_ansible_created.status == 204"
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ ansible_host }}:3000/api/project/{{ semaphore_project_id }}/keys"
|
||||
method: POST
|
||||
headers:
|
||||
Cookie: "{{ semaphore_login.cookies_string }}"
|
||||
body: "{{ lookup('ansible.builtin.template', 'key.yml.j2') | from_yaml | to_json }}"
|
||||
body_format: json
|
||||
status_code: 204
|
||||
timeout: 5
|
||||
register: semaphore_key_ansible_created
|
||||
when: semaphore_keystores.json | selectattr('name', 'equalto', 'None') | length == 0
|
||||
|
||||
- name: Get key id
|
||||
changed_when: false
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ ansible_host }}:3000/api/project/{{ semaphore_project_id }}/keys"
|
||||
method: GET
|
||||
headers:
|
||||
Cookie: "{{ semaphore_login.cookies_string }}"
|
||||
status_code: 200
|
||||
timeout: 5
|
||||
register: semaphore_keystores
|
||||
|
||||
- name: Parse semaphore_ansible_none_key_id
|
||||
ansible.builtin.set_fact:
|
||||
semaphore_ansible_none_key_id: "{{ semaphore_keystores.json | selectattr('name', 'equalto', 'None') | map(attribute='id') | first }}"
|
Loading…
Add table
Add a link
Reference in a new issue