-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add ansible role to provision the kubetail command line tool
- Loading branch information
1 parent
a407dff
commit bdc8de3
Showing
9 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
provisioners/ansible/roles/kubernetes/kubetail/defaults/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
kubetail_version: '1.6.17' | ||
kubetail_install_dir: '/usr/local/bin' | ||
... |
15 changes: 15 additions & 0 deletions
15
provisioners/ansible/roles/kubernetes/kubetail/handlers/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- name: 'Check installed kubetail version' | ||
shell: '{{ kubetail_install_dir }}/kubetail --version 2>/dev/null' | ||
args: | ||
executable: '/bin/bash' | ||
changed_when: false | ||
register: 'kubetail_installed_version' | ||
|
||
- name: 'Verify installed kubetail version' | ||
assert: | ||
that: | ||
- 'kubetail_version == kubetail_installed_version.stdout' | ||
fail_msg: 'kubetail installation failed, {{ kubetail_version }} != {{ kubetail_installed_version.stdout }}' | ||
success_msg: 'Installed kubetail version is: {{ kubetail_version }}' | ||
... |
80 changes: 80 additions & 0 deletions
80
provisioners/ansible/roles/kubernetes/kubetail/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
- name: 'Check if is already installed' | ||
stat: | ||
path: '{{ kubetail_install_dir }}/kubetail' | ||
register: 'kubetail_check_existing' | ||
|
||
- name: 'Check existing version' | ||
shell: "{{ kubetail_install_dir }}/kubetail --version 2>/dev/null" | ||
args: | ||
executable: '/bin/bash' | ||
failed_when: false | ||
changed_when: false | ||
register: 'kubetail_existing_version' | ||
when: 'kubetail_check_existing.stat.exists' | ||
|
||
- name: 'Ensure installation directory exists' | ||
file: | ||
path: '{{ kubetail_install_dir }}' | ||
state: 'directory' | ||
mode: 0755 | ||
owner: 'root' | ||
group: 'root' | ||
become: 'yes' | ||
|
||
- name: 'Remove current installed version' | ||
file: | ||
path: '{{ kubetail_install_dir }}/kubetail' | ||
state: 'absent' | ||
become: 'yes' | ||
when: | ||
- 'kubetail_check_existing.stat.exists' | ||
- 'kubetail_existing_version.stdout != kubetail_version' | ||
|
||
- name: 'Unarchive zip folder' | ||
unarchive: | ||
src: '{{ kubetail_download_url }}' | ||
dest: '/tmp' | ||
mode: 0755 | ||
remote_src: 'yes' | ||
become: 'yes' | ||
when: > | ||
not kubetail_check_existing.stat.exists | ||
or kubetail_existing_version.stdout != kubetail_version | ||
- name: 'Copy script to installation directory' | ||
copy: | ||
src: '/tmp/kubetail-{{ kubetail_version }}/kubetail' | ||
dest: '{{ kubetail_install_dir }}/kubetail' | ||
owner: 'root' | ||
group: 'root' | ||
mode: 0755 | ||
become: 'yes' | ||
when: > | ||
not kubetail_check_existing.stat.exists | ||
or kubetail_existing_version.stdout != kubetail_version | ||
notify: | ||
- 'Check installed kubetail version' | ||
- 'Verify installed kubetail version' | ||
|
||
- name: 'Remove bash completion script' | ||
file: | ||
path: '/etc/profile.d/kubetail.sh' | ||
state: 'absent' | ||
become: 'yes' | ||
when: | ||
- 'kubetail_check_existing.stat.exists' | ||
- 'kubetail_existing_version.stdout != kubetail_version' | ||
|
||
- name: 'Enable bash completion' | ||
copy: | ||
src: '/tmp/kubetail-{{ kubetail_version }}/completion/kubetail.bash' | ||
dest: '/etc/profile.d/kubetail.sh' | ||
owner: 'root' | ||
group: 'root' | ||
mode: 0644 | ||
become: 'yes' | ||
when: > | ||
not kubetail_check_existing.stat.exists | ||
or kubetail_existing_version.stdout != kubetail_version | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
kubetail_zip_folder: '{{ kubetail_version }}.zip' | ||
kubetail_download_url: 'https://github.com/johanhaleby/kubetail/archive/refs/tags/{{ kubetail_zip_folder }}' | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,7 @@ | |
- "kubectl" | ||
- "kubectx" | ||
- "kubefwd" | ||
- "kubetail" | ||
- "helm" | ||
- "helm_dash" | ||
- "kind" | ||
|