chore!: separated galaxy deps and own collections; modified ansible script generation to use two paths for collections
REQUIRES REGENERATING ansible.cfg!
This commit is contained in:
parent
4af69c31ce
commit
888590ed9f
188 changed files with 30 additions and 30 deletions
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
- name: install required packages
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
force_apt_get: true
|
||||
cache_valid_time: 3600
|
||||
pkg:
|
||||
- curl
|
||||
- jq
|
||||
|
||||
- name: find if binary is already installed
|
||||
ansible.builtin.file:
|
||||
path: '{{ kubectl_binary_path }}'
|
||||
register: kubectl_stat
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: find current installed version
|
||||
when: kubectl_stat.state != "absent"
|
||||
ansible.builtin.shell: "{{ kubectl_binary_path }} version --client=true --output=json | jq --raw-output '.clientVersion.gitVersion'"
|
||||
changed_when: false
|
||||
register: kubectl_local_version_exec
|
||||
|
||||
- name: find latest available version
|
||||
connection: local
|
||||
ansible.builtin.command: curl -L -s https://dl.k8s.io/release/stable.txt
|
||||
register: latest_kubectl_version_exec
|
||||
when: kubectl_install_version is falsy or kubectl_install_version == "latest"
|
||||
changed_when: false
|
||||
|
||||
- name: set kubectl facts
|
||||
ansible.builtin.set_fact:
|
||||
kubectl_latest_version_available: '{{ latest_kubectl_version_exec.get("stdout", "") if latest_kubectl_version_exec is defined }}'
|
||||
kubectl_local_version: '{{ kubectl_local_version_exec.get("stdout", "") if kubectl_local_version_exec is defined }}'
|
||||
kubectl_target_install_version: '{{ kubectl_install_version if kubectl_install_version != "latest" else latest_kubectl_version_exec.get("stdout", "") }}'
|
||||
|
||||
- name: install binary
|
||||
become: true
|
||||
when: kubectl_stat.state == "absent" or (kubectl_local_version != kubectl_target_install_version and kubectl_install_version is not falsy)
|
||||
ansible.builtin.get_url:
|
||||
url: "https://dl.k8s.io/release/{{ kubectl_target_install_version }}/bin/linux/amd64/kubectl"
|
||||
dest: /usr/local/bin/kubectl
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
force: true
|
Loading…
Add table
Add a link
Reference in a new issue