<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>

Mr.DevEng
<p>After trying lot of research I found that need to put the parameters "--ask-pass --become --ask-become-pass"  when we are running the ansible playbook. I tried the following command,</p>

<pre><code>sudo ansible-playbook -i inventory/sample/hosts.ini cluster.yml --user=docker --ask-pass --become --ask-become-pass
</code></pre>

<p>And , when it is continuing with kubernetes cluster deployment , it will again arise the problem of inventory name need to use only with small letteres. So I edited all the inventory name and etc/hostname and /etc/hosts with small case hostname . And also putted all small letters in inventory file. Now its working successfully. </p>

<p>the /etc/hosts contain like following,</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>etc/hostname</p>

<pre><code>mildevdcr01
</code></pre>

<p>And hosts.ini file like the following,</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>It we are doing like this, we will get the deployed Kubernetes cluster on destination host machines. </p>
