# KVM/Qemu Running playbook from host

**URL:** <https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382>\
**Category:** Ansible Project\
**Created:** [August 28, 2023, 6:37pm UTC](https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382 "2023-08-28T18:37:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Kumar3](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Amit\_Kumar3](https://forum.ansible.com/u/Amit_Kumar3)\
**Post date:** [August 28, 2023, 6:37pm UTC](https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382/1 "2023-08-28T18:37:35Z")

</div>

Task: checking if pip is installed or not, if not then installing pip.

playbook.yml

---

<div class="post-metadata">

**Author:** ![Amit\_Kumar3](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Amit\_Kumar3](https://forum.ansible.com/u/Amit_Kumar3)\
**Post date:** [August 28, 2023, 6:39pm UTC](https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382/2 "2023-08-28T18:39:47Z")

</div>

Simple playbook with only debug works but this does not work

---

<div class="post-metadata">

**Author:** ![Evan\_Hisey](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Evan\_Hisey](https://forum.ansible.com/u/Evan_Hisey)\
**Post date:** [August 28, 2023, 7:07pm UTC](https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382/3 "2023-08-28T19:07:10Z")

</div>

What is the simple playbook? The issue is definitely in the ssh connection. Does demouser actually exist on the target host and is the target host the same?

---

<div class="post-metadata">

**Author:** ![Amit\_Kumar3](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@Amit\_Kumar3](https://forum.ansible.com/u/Amit_Kumar3)\
**Post date:** [August 28, 2023, 7:28pm UTC](https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382/4 "2023-08-28T19:28:45Z")

</div>

Hi

demouser does exist on the system. The simple playbook is printing debug message.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [August 28, 2023, 7:43pm UTC](https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382/5 "2023-08-28T19:43:44Z")

</div>

Hii

You are overcomplicating things by first doing a stat on /usr/bin/pip.  
Besides that, the existence of that path is a very fragile way of detecting if the python3-package is installed.  
If you only want to install something if it is not installed already, then that is just what the apt module will do.  
That is called idempotence, and IMHO is one of the key features of ansible.

Just have one apt task and be done with it.

The output also notifies you that the group name you use is illegal. It also tells you how to get more information (using -vvvv).  
In general, before posting questions, make sure that you don’t unnecessarily complicate things by adding obvious errors.  
It will give a somewhat careless impression, and it will distract the audience, neither of which will help you get answers to your question.

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [August 28, 2023, 7:48pm UTC](https://forum.ansible.com/t/kvm-qemu-running-playbook-from-host/38382/6 "2023-08-28T19:48:31Z")

</div>

> Hi
> 
> demouser does exist on the system. The simple playbook is printing debug message.
> 
> * * *
> 
> - name: Testing if everything works on the remote  
> hosts: ubuntu-servers  
> gather\_facts: false  
> tasks:
> - name: Hello Server  
> debug:  
> msg: “Hello Ubuntu Server”

Just telling that it is “printing the debug message” is very little information.  
Using one or more verbose levels would help.

Also, your debug playbook is not using become, and it not having the “ansible\_user: demouser” statement.  
Both play an important role in the connection setup.  
Make sure you are comparing apples to apples.
