<p>I am trying to run one Ansible playbook for deploying Kubernetes cluster using the tool kubespray on Ubuntu 16.04 OS. I have one base machine which is installed with Ansible and cloned kubespray Git repository. And one master and two worker nodes containing in cluster.</p>
<p><strong>My host (Updated) file like the followig screenshot,</strong></p>
<pre><code>[all]
MILDEVKUB020 ansible_ssh_host=MILDEVKUB020 ip=192.168.16.173 ansible_user=uName  ansible_ssh_pass=pwd
MILDEVKUB030 ansible_ssh_host=MILDEVKUB030 ip=192.168.16.176 ansible_user=uName  ansible_ssh_pass=pwd
MILDEVKUB040 ansible_ssh_host=MILDEVKUB040 ip=192.168.16.177 ansible_user=uName  ansible_ssh_pass=pwd

[kube-master]
MILDEVKUB020

[etcd]
MILDEVKUB020

[kube-node]
MILDEVKUB020
MILDEVKUB030
MILDEVKUB040

[k8s-cluster:children]
kube-master
kube-node
</code></pre>
<p>Location of hosts.ini file is /inventory/sample. And I am trying the following Ansible command</p>
<pre><code>sudo ansible-playbook -i inventory/sample/hosts.ini cluster.yml --user=uName --extra-vars &quot;ansible_sudo_pass=pwd&quot;
</code></pre>
<p>And I am using the playbook &quot;cluster.yml&quot; from the following link</p>
<p><a href="https://github.com/kubernetes-sigs/kubespray/blob/master/cluster.yml" rel="nofollow noreferrer">https://github.com/kubernetes-sigs/kubespray/blob/master/cluster.yml</a></p>
<p><strong>And my /etc/hosts file containing the entries ,</strong></p>
<pre><code>127.0.0.1 MILDEVDCR01.Milletech.us MILDEVDCR01
192.168.16.173 MILDEVKUB020.Milletech.us MILDEVKUB020
192.168.16.176 MILDEVKUB030.Milletech.us MILDEVKUB030
192.168.16.177 MILDEVKUB040.Milletech.us MILDEVKUB040
</code></pre>
<p><strong>Updated error</strong></p>
<pre><code>TASK [adduser : User | Create User Group] 
Thursday 04 April 2019  11:34:55 -0400 (0:00:00.508)       0:00:33.383 ********
fatal: [MILDEVKUB040]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;groupadd: Permission denied.\ngroupadd: cannot lock /etc/group; try again later.\n&quot;, &quot;name&quot;: &quot;kube-cert&quot;}
fatal: [MILDEVKUB020]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;groupadd: Permission denied.\ngroupadd: cannot lock /etc/group; try again later.\n&quot;, &quot;name&quot;: &quot;kube-cert&quot;}
fatal: [MILDEVKUB030]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;msg&quot;: &quot;groupadd: Permission denied.\ngroupadd: cannot lock /etc/group; try again later.\n&quot;, &quot;name&quot;: &quot;kube-cert&quot;}
</code></pre>
<p>I am getting error like this even if I am able to connect all machine from base machine using ssh. How can I trace what is my issue for running this command to deploy Kubernetes cluster?</p>

<p>If you are using user/password combination to login. The user with which ansible is getting executed should be present in the sudoers file to switch to root or another other privileged user </p>

<p>Check the sudoers and try to manually do a sudo su root on the target server</p>
