<p>Got the solution :</p>

<p>in the inventory file (<code>/etc/ansible/hosts</code>) :</p>

<pre><code>[host]
192.XXX.XXX.XXX ansible_user=ubuntu1(target hostname) ansible_become_password=XXXXXXXX(target pwd)
</code></pre>

<p>and in the play we have to set</p>

<pre><code>- hosts: host
  become: yes
  tasks:
    -name : Update XYZ app
     script: update.py

</code></pre>

<p>I have already written a python script for my process so I have giving same script here in .yml</p>

CC BY-SA 4.0
2019-11-01T05:27:36.290Z
is that a plain-text password? :(
user2818782
CC BY-SA 4.0
2019-11-01T05:29:11.170Z
@user2818782   use that's the plain pswd which i have stored in the inventory/hosts file but you can put it in vault for the security reasons .For now i have used plain text password which is of my node/target machine not a controller .
Akshay Kumar
CC BY-SA 4.0
2019-11-01T06:03:57.100Z
ah. righto. that makes sense :)
user2818782
CC BY-SA 4.0
2019-11-01T06:05:46.837Z
@user2818782  yes ,in case you are getting any error do let me know i will investigate further but for now that above method will work to push any updates to your target machine from controller .
Akshay Kumar
CC BY-SA 4.0
2019-10-29T19:42:48.713Z
2019-10-31T06:24:04.550Z
2019-10-31T06:24:04.550Z
Akshay Kumar
<p>Simple one.
You should either add <code>ansible_ssh_extra_args="-o StrictHostKeyChecking=no"</code> to inventory or <code>disableHostKeyChecking: true</code> into Jenkins pipeline script (inside ansiblePlaybook block).</p>

<p>Like this:</p>

<pre><code>ansiblePlaybook(
  colorized: true,
  installation: 'ansible27'
  inventory: '[hostsfile]'
  playbook: '[playbook]'
  disableHostKeyChecking: true
)
</code></pre>

CC BY-SA 4.0
2019-10-17T10:15:52.437Z
Hi Simth , thanks i will have check and update you hope it will work as i am expecting .
Akshay Kumar
CC BY-SA 4.0
2019-10-29T19:43:17.667Z
Got the solution :

in host/inventory file which is /etc/ansible/hosts [host] 192.XXX.XXX.XXX ansible_user=ubuntu1(target hostname) ansible_become_password=XXXXXXXX(target pwd)

and in .yml part

we have to mentioned - hosts: host become: yes tasks: -name : Update XYZ app script: update.py (in have already written a python script for my process so i have giving same script here in .yml)
Akshay Kumar
CC BY-SA 4.0
2019-10-17T10:11:44.970Z
2019-10-17T10:16:49.540Z
2019-10-17T10:16:49.540Z
Mr Smith
<p><a href="https://i.sstatic.net/y7rUP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/y7rUP.png" alt="enter image description here"></a></p>

<p>Please look into this error trying to implement the deploy.yml file with ansible plugin which is installed in the jenkins.</p>

<p>In ansible console I can implement the app successfully to the target machine but while same deploy.yml file using in jenkins getting error .</p>

<p>Tried :</p>

<ol>
<li>ssh connection from target and master machine able to connect</li>
<li>Add the rsa key/finger print key to the target machine as well as in master controller .</li>
<li>From terminal i can able to access target machine as well as can able to deploy any app to any VM but while switched to jenkins ansible plugin getting error. </li>
</ol>

CC BY-SA 4.0
2019-10-16T19:37:25.857Z
I'm thinking that you're using `-k` which means "ask for password", which is what the error message is about.
schaiba
CC BY-SA 4.0
2019-10-17T05:06:52.243Z
Why are you telling us all this, i.e what is your actual question?
Pierre.Vriens
CC BY-SA 4.0
2019-10-17T05:11:29.637Z
My actual questions is : how to run ansible file in Jenkins using ansible plugin which i have already installed but still getting used that snap error . Question is that which is in snapshot error how to run .
Akshay Kumar
CC BY-SA 4.0
2019-10-17T05:12:22.003Z
Hi thanks for your response but i can't find -k in any of my cmd which i have written in .yml or /hosts @schaiba
Akshay Kumar
CC BY-SA 4.0
2019-10-29T19:43:49.030Z
@schaiba  Got the solution :

in host/inventory file which is /etc/ansible/hosts [host] 192.XXX.XXX.XXX ansible_user=ubuntu1(target hostname) ansible_become_password=XXXXXXXX(target pwd)

and in .yml part

we have to mentioned - hosts: host become: yes tasks: -name : Update XYZ app script: update.py (in have already written a python script for my process so i have giving same script here in .yml)
Akshay Kumar
<jenkins><ansible><jenkins-plugins>
How to run Ansible file in Jenkins using Ansible plugin
Akshay Kumar
# How to run Ansible file in Jenkins using Ansible plugin

(Asked by: username_0 on 2019-10-16)

[![enter image description here](https://i.sstatic.net/y7rUP.png)](https://i.sstatic.net/y7rUP.png)

Please look into this error trying to implement the deploy.yml file with ansible plugin which is installed in the jenkins.

In ansible console I can implement the app successfully to the target machine but while same deploy.yml file using in jenkins getting error .

Tried :

1. ssh connection from target and master machine able to connect
2. Add the rsa key/finger print key to the target machine as well as in master controller .
3. From terminal i can able to access target machine as well as can able to deploy any app to any VM but while switched to jenkins ansible plugin getting error.

**Tags:** jenkins, ansible, jenkins-plugins

> **Comments:**
> **username_1**: I'm thinking that you're using `-k` which means "ask for password", which is what the error message is about.  
> **username_2**: Why are you telling us all this, i.e what is your actual question?  
> **username_0**: My actual questions is : how to run ansible file in Jenkins using ansible plugin which i have already installed but still getting used that snap error . Question is that which is in snapshot error how to run .  
> **username_0**: Hi thanks for your response but i can't find -k in any of my cmd which i have written in .yml or /hosts @username_1  
> **username_0**: @username_1  Got the solution :  in host/inventory file which is /etc/ansible/hosts [host] 192.XXX.XXX.XXX ansible_user=ubuntu1(target hostname) ansible_become_password=XXXXXXXX(target pwd)  and in .yml part  we have to mentioned - hosts: host become: yes tasks: -name : Update XYZ app script: update.py (in have already written a python script for my process so i have giving same script here in .yml)  

---

## 2 answers

### Answer by username_0 on 2019-10-29. Score: 1 | Accepted answer

Got the solution :
in the inventory file (/etc/ansible/hosts) :
[host]
192.XXX.XXX.XXX ansible_user=ubuntu1(target hostname) ansible_become_password=XXXXXXXX(target pwd)

and in the play we have to set
- hosts: host
  become: yes
  tasks:
    -name : Update XYZ app
     script: update.py


I have already written a python script for my process so I have giving same script here in .yml

> **Comments:**
> **username_3**: is that a plain-text password? :(  
> **username_0**: @username_3   use that's the plain pswd which i have stored in the inventory/hosts file but you can put it in vault for the security reasons .For now i have used plain text password which is of my node/target machine not a controller .  
> **username_3**: ah. righto. that makes sense :)  
> **username_0**: @username_3  yes ,in case you are getting any error do let me know i will investigate further but for now that above method will work to push any updates to your target machine from controller .  

---

### Answer by username_4 on 2019-10-17. Score: 3

Simple one.
You should either add ansible_ssh_extra_args="-o StrictHostKeyChecking=no" to inventory or disableHostKeyChecking: true into Jenkins pipeline script (inside ansiblePlaybook block).
Like this:
ansiblePlaybook(
  colorized: true,
  installation: 'ansible27'
  inventory: '[hostsfile]'
  playbook: '[playbook]'
  disableHostKeyChecking: true
)

> **Comments:**
> **username_0**: Hi Simth , thanks i will have check and update you hope it will work as i am expecting .  
> **username_0**: Got the solution :  in host/inventory file which is /etc/ansible/hosts [host] 192.XXX.XXX.XXX ansible_user=ubuntu1(target hostname) ansible_become_password=XXXXXXXX(target pwd)  and in .yml part  we have to mentioned - hosts: host become: yes tasks: -name : Update XYZ app script: update.py (in have already written a python script for my process so i have giving same script here in .yml)  

---

