Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexible Configuration + Pull Latest Version #13

Merged
merged 6 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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