Skip to content

Commit

Permalink
feat: integrate different install path and owner/group
Browse files Browse the repository at this point in the history
  • Loading branch information
Shackelford-Arden committed Feb 2, 2024
1 parent 4d8633b commit a665f30
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
8 changes: 8 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ starship_arch: "{{ ansible_architecture }}"
# @var starship_download:description: URL to the archive of the release to install
starship_download: "https://github.com/starship/starship/releases/download/v{{ starship_version }}/starship-{{ starship_arch }}-unknown-linux-musl.tar.gz"

# @var starship_install_directory:description: Directory in which to install the Starship binary
starship_install_directory: "/usr/bin"

# @var starship_owner:description: User who will own the Starship binary file
starship_owner: root

# @var starship_group:description: Group who will own the Starship binary file
starship_group: root
...
16 changes: 10 additions & 6 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# Standards: 1.2
---
- name: Check existing install

- name: Check Existing Install
register: starship_version_check
failed_when: False
changed_when: False
check_mode: False
shell: /usr/bin/starship --version 2>&1
shell: "{{ starship_install_directory }}/starship --version 2>&1"
tags:
- starship

- name: Fact version change
when:
- starship_version_check.stdout_lines is defined
- starship_version not in starship_version_check.stdout_lines[0]
set_fact:
starship_version_changed: "{{ starship_version_check.rc != 0 or (starship_version_check.stdout_lines is defined and starship_version not in starship_version_check.stdout_lines[0]) | bool }}"
starship_version_changed: True
tags:
- starship

Expand All @@ -20,10 +24,10 @@
- starship_version_changed
unarchive:
src: "{{ starship_download }}"
dest: /usr/bin
dest: "{{ starship_install_directory }}"
remote_src: True
owner: root
group: root
owner: "{{ starship_owner }}"
group: "{{ starship_group }}"
tags:
- starship

Expand Down
1 change: 1 addition & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
starship_version_changed: False

0 comments on commit a665f30

Please sign in to comment.