Ansible can't handle kubectl proxy command Ansible can't handle kubectl proxy command kubernetes kubernetes

Ansible can't handle kubectl proxy command


You could run the task with the asynchronous option. For example:

- name: Expose Dashboard UI  shell: "(kubectl proxy --port=8001 --address={{ hostvars['master'].master_node_ip }} --accept-hosts="^*$" >> dashboard_started.txt >/dev/null 2>&1 &)"  args:    chdir: $HOME    creates: dashboard_started.txt  async: 10  poll: 0

When poll is 0, Ansible will start the task and immediately move on to the next one without waiting for a result.

I personally added the subshell parentheses though i suppose that there is no need to use them, async itself does the trick I hope!

Hope it helps!

https://docs.ansible.com/ansible/latest/user_guide/playbooks_async.html