feat: Preconfigure root profile for cli tools
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2023-07-15 19:09:44 +02:00
parent 072fc56050
commit 05f085aee7
2 changed files with 17 additions and 12 deletions

View File

@ -42,19 +42,30 @@
retries: "{{ playbook.retries }}" retries: "{{ playbook.retries }}"
delay: "{{ (storage_benchmark | int) * (playbook.delay.medium | int) }}" delay: "{{ (storage_benchmark | int) * (playbook.delay.medium | int) }}"
- name: Install kubectl tab-completion - name: Install tab-completion
ansible.builtin.shell: ansible.builtin.shell:
cmd: kubectl completion bash | tee /etc/bash_completion.d/kubectl cmd: |-
{{ item }} completion bash > /etc/bash_completion.d/{{ item }}
creates: /etc/bash_completion.d/{{ item }}
loop:
- kubectl
- helm
- step
- name: Initialize tempfile - name: Create kubeconfig dictionary
ansible.builtin.tempfile: ansible.builtin.set_fact:
state: file kubeconfig: "{{ { 'path': ansible_env.HOME ~ '/.kube/config' } }}"
register: kubeconfig
- name: Create kubeconfig target folder
ansible.builtin.file:
path: "{{ kubeconfig.path | dirname }}"
state: directory
- name: Retrieve kubeconfig - name: Retrieve kubeconfig
ansible.builtin.command: ansible.builtin.command:
cmd: kubectl config view --raw cmd: kubectl config view --raw
register: kubectl_config register: kubectl_config
no_log: true
- name: Store kubeconfig in tempfile - name: Store kubeconfig in tempfile
ansible.builtin.copy: ansible.builtin.copy:

View File

@ -1,12 +1,6 @@
- import_tasks: service.yml - import_tasks: service.yml
- import_tasks: cron.yml - import_tasks: cron.yml
- name: Cleanup tempfile
ansible.builtin.file:
path: "{{ kubeconfig.path }}"
state: absent
when: kubeconfig.path is defined
# - name: Reboot host # - name: Reboot host
# ansible.builtin.shell: # ansible.builtin.shell:
# cmd: systemctl reboot # cmd: systemctl reboot