command fails because needs to be root

12/12/2019

I'm testing thi project :

https://github.com/sayems/kubernetes.resources/

And just for my understanding i commented out the ansible provisioning in the vagant part :

https://github.com/sayems/kubernetes.resources/blob/master/k8s-vagrant/Vagrantfile#L34

to

https://github.com/sayems/kubernetes.resources/blob/master/k8s-vagrant/Vagrantfile#L41

Then ran :

vagrant up 

Witch start a non provisioned cluster a wanted

Then :

ansible-playbook playbook.yml -i inventory.ini

But I'm getting this error :

TASK [token : Copy join command to local file] ******************************************************************************************************************************************************************************************************************************* fatal: [k8s-master]: FAILED! => {"msg": "Failed to get information on remote file (./join-command): sudo: il est nécessaire de saisir un mot de passe\n"}

If i understand it needs to be root to execute this command :

https://github.com/sayems/kubernetes.resources/blob/master/k8s-vagrant/roles/join/tasks/main.yml

But we are supposed to be root :

https://github.com/sayems/kubernetes.resources/blob/master/k8s-vagrant/playbook.yml

can anyone help or have an idea ?

Thanks

-- user1361815
ansible
kubernetes
vagrant

1 Answer

12/12/2019

I think you need to run it with sudo. Modules like copy expect to be available as the user running Ansible.

Reference

-- moonmoon
Source: StackOverflow