diff --git a/ansible/roles/get_control/files/bashrc_oas b/ansible/roles/get_control/files/bashrc_oas new file mode 100644 index 0000000000000000000000000000000000000000..fa73f8f60083cacb663fdc9a8cb029e5b96b021b --- /dev/null +++ b/ansible/roles/get_control/files/bashrc_oas @@ -0,0 +1,9 @@ +# Bashrc additions for Openappstack +# This file is sourced from .bashrc + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi diff --git a/ansible/roles/get_control/tasks/main.yml b/ansible/roles/get_control/tasks/main.yml index a7917a8bf2784cfdcce86e2fb01d6be5e35c4acb..28a06d7a372af52da57803c3893da2a187cfa468 100644 --- a/ansible/roles/get_control/tasks/main.yml +++ b/ansible/roles/get_control/tasks/main.yml @@ -41,19 +41,44 @@ content: "{{ ip_address }}" dest: "{{ configuration_directory }}/ip" -- name: Remove old files from previous deploys - file: - path: '{{ item }}' - state: absent - with_items: - - '/root/.bashrc_oas' - - '/root/.bash_aliases_oas' - become: true +- name: Install bash-completion + tags: + - bash + - completion + package: + name: "bash-completion" + +- name: Add kubectl bash kompletion + tags: + - bash + - kubectl + - completion + shell: kubectl completion bash > /etc/bash_completion.d/kubectl + args: + creates: /etc/bash_completion.d/kubectl -- name: Restore original .bashrc +- name: Add helm bash kompletion + tags: + - bash + - helm + - completion + shell: helm completion bash > /etc/bash_completion.d/helm + args: + creates: /etc/bash_completion.d/helm + +- name: Deploy /root/.bashrc_oas + tags: + - bash + copy: + dest: /root/.bashrc_oas + src: bashrc_oas + +- name: Source /root/.bashrc_oas from /root/.bashrc + tags: + - bash blockinfile: path: "/root/.bashrc" - state: absent + state: present create: true block: | # Source Openappstack addtions from .bashrc_oas