Help with Ansible playbook error while deploying Kubernetes w/ Kubespray
April 24, 2018 12:14 PM   Subscribe

I'm attempting to run Ansible playbook to set up Kubernetes Cluster using Kubespray. I've followed all steps but my nodes are still failing. Help please!

When I run the command `ansible-playbook -i inventory/mycluster/hosts.ini cluster.yml` it spits out the below error for each node:

`[node1]: FAILED! => {"changed": false, "module_stderr": "Shared connection to X.X.X.X closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_NvXD7o/ansible_module_lineinfile.py\", line 512, in \r\n main()\r\n File \"/tmp/ansible_NvXD7o/ansible_module_lineinfile.py\", line 508, in main\r\n absent(module, path, params['regexp'], params. get('line', None), backup)\r\n File \"/tmp/ansible_NvXD7o/ansible_module_lineinfile.py\", line 408, in absent\r\n f = open(b_dest,'rb')\r\nIOError: [Errno13] Permission denied: '/etc/sudoers'\r\n", "msg": "MODULE FAILURE", "rc": 1}`

Anything obvious I'm missing?
posted by rbf1138 to Computers & Internet (3 answers total) 2 users marked this as a favorite
 
This type of question will likely get a better response on stack exchange or someplace like that, but I can try to answer.

It looks like the andible role is trying to edit /etc/sudoers and the error is that user running ansible is not running as root. You can add a become_user statement the the relevant part of the playbook or run it as root (but that’s not a good solution unless you know exactly what you’re doing and why).
posted by unix at 12:36 PM on April 24, 2018


Seconding that you might need to use become to get superuser permissions, but if you're trying to edit `/etc/sudoers` to give yourself sudo access, that's a catch-22. Are you allowed to use sudo on that system, as your current user?

It may also be helpful to use `--step` and/or one or more levels of verbosity (`-v`, `-vv`, etc.) to get more details.
posted by silentbicycle at 12:55 PM on April 24, 2018 [1 favorite]


yep, what silentbycyle said: you need to use become: yes (which used to be sudo: yes) - from the output you provided, it looks to me like that specific play is trying to use ansible's lineinfile module to manipulate /etc/sudoers and doesn't have permissions to do so.
posted by namewithoutwords at 3:51 PM on April 24, 2018


« Older Breastfeeding questions - low milk production...   |   Old short story about a man who intentionally... Newer »
This thread is closed to new comments.