Ansible-OpenShift-Provisioning icon indicating copy to clipboard operation
Ansible-OpenShift-Provisioning copied to clipboard

/root/.kube/config does not match /home/{{user}}/.kube/config when reinstall OCP cluster

Open smolin-de opened this issue 2 years ago • 1 comments

If you do not specify 'root' as bastion user in the variable 'env.bastion.access.user', then the /root/.kube/config file will not be updated during reinstall OCP cluster. The correct .kube/config file will be located only in the directory: "/home{{ env.bastion.access.user }}/.kube/config"

smolin-de avatar Jul 10 '23 14:07 smolin-de

i think all home directory usages in the playbook should be replaced with

    - name: get user home directory
      shell: >
             getent passwd {{ user_name_variable }}  | awk -F: '{ print $6 }'
      changed_when: false
      register: user_home

    - name: debug output
      debug:
        var: user_home.stdout

and then use the value you get

Not only is root/non root the issue, it is also possible for someone to be using a different homedirectory than /home/username

mohammedzee1000 avatar Oct 27 '23 06:10 mohammedzee1000