Skip to content

Commit

Permalink
on-prem install
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Nov 13, 2024
1 parent 034a045 commit a51aa73
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 2 additions & 0 deletions inventory/dev/group_vars/semaphore.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
---
semaphore_download_url: 'https://github.com/semaphoreui/semaphore/releases/download/v2.10.35/semaphore_2.10.35_linux_amd64.tar.gz'
semaphore_download_binary: false
semaphore_web_root: 'https://controller'
semaphore_db_host: '127.0.0.1'
controller_repository_name: "example-repo"
Expand Down
1 change: 1 addition & 0 deletions roles/semaphore/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
desired_state: present
semaphore_download_binary: true
verify_state: true
# Easier debugging
debug: false
Expand Down
25 changes: 18 additions & 7 deletions roles/semaphore/tasks/present.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,28 @@
group: semaphore
mode: '0600'

- name: Get Semaphore Release info from Github
ansible.builtin.uri:
url: https://api.github.com/repos/semaphoreui/semaphore/releases/latest
return_content: true
body_format: json
register: semaphore_release
- name: Find Semaphore release
when: semaphore_download_url is not defined
block:

- name: Get Semaphore Release info from Github
ansible.builtin.uri:
url: https://api.github.com/repos/semaphoreui/semaphore/releases/latest
return_content: true
body_format: json
register: _sem_rel

- name: Set semaphore_download_url
ansible.builtin.set_fact:
semaphore_download_url: "{{ semaphore_releases_url }}/{{ _sem_rel.json.name }}/semaphore_{{ _sem_rel.json.name[1:] }}_linux_amd64.tar.gz"

- name: Install Semaphore binary
when: semaphore_download_binary | bool
block:

- name: Download semaphore
ansible.builtin.get_url:
url: https://github.com/semaphoreui/semaphore/releases/download/{{ semaphore_release.json.name }}/semaphore_{{ semaphore_release.json.name[1:] }}_linux_amd64.tar.gz
url: "{{ semaphore_download_url }}"
dest: /tmp/semaphore.tar.gz
mode: '0755'

Expand Down Expand Up @@ -101,6 +111,7 @@
become_user: semaphore
ansible.builtin.command:
cmd: ansible-galaxy collection install --upgrade -r /home/semaphore/requirements.yml
changed_when: true

- name: Check if env file exists
ansible.builtin.stat:
Expand Down
1 change: 1 addition & 0 deletions roles/semaphore/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
semaphore_releases_url: 'https://github.com/semaphoreui/semaphore/releases/download'
semaphore_admin_password: "{{ vault_admin_password }}"
semaphore_cookie_hash: "{{ vault_cookie_hash }}"
semaphore_cookie_encryption: "{{ vault_cookie_encryption }}"
Expand Down

0 comments on commit a51aa73

Please sign in to comment.