Use local ansible to talk to engineVM and other vm

I have a self-hosted-engine (4.2) running on a centos 7.4 server. I have downloaded ovirt ansible roles from ansible-galaxy and can run them from the server where the engineVM is running and able to deploy new vms, clusters, dc, etc. I have seen the use of ovirt4.py file to target and group hosts which you can target for specific plays. However, the box where self-hosted-engine is running is a physical server but I am looking to run ansible from my local machine instead to manage vms running on engineVM. Is there a way to achieve this? Thank you in advance.

On 05/21/2018 11:51 AM, 03ce007@gmail.com wrote:
I have a self-hosted-engine (4.2) running on a centos 7.4 server.
I have downloaded ovirt ansible roles from ansible-galaxy and can run them from the server where the engineVM is running and able to deploy new vms, clusters, dc, etc.
I have seen the use of ovirt4.py file to target and group hosts which you can target for specific plays. However, the box where self-hosted-engine is running is a physical server but I am looking to run ansible from my local machine instead to manage vms running on engineVM. Is there a way to achieve this?
Sure you can use your own computer to manage the VMs. In your playbook you just need to specify group/host where the tasks of the playbook should run. So if using the ovirt4.py script as your inventory file, you need to just specify specific group where you want to run the tasks in your playbook like this: - hosts: tag_httpd tasks: ... If you want to Create/Delete VMs using ovirt_* modules, you can do it from your computer as well, but you need to install Python SDK version 4. You can download it from pip using following command: pip install ovirt-engine-sdk-python.
Thank you in advance.
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org

Thanks. Is there a way to use an existing inventory file? I asked because the server where the engineVM is running is listed into my existing a ansible inventory file on my local machine, but how do I specify/run the subsequent tasks which I want to run on vms running on engineVM as I don't see the /etc/hosts file updated where engineVM runs. How would my local ansible playbook know which vms are available, etc? On Tue, 22 May 2018, 8:36 am Ondra Machacek, <omachace@redhat.com> wrote:
I have a self-hosted-engine (4.2) running on a centos 7.4 server.
I have downloaded ovirt ansible roles from ansible-galaxy and can run
On 05/21/2018 11:51 AM, 03ce007@gmail.com wrote: them from the server where the engineVM is running and able to deploy new vms, clusters, dc, etc.
I have seen the use of ovirt4.py file to target and group hosts which
you can target for specific plays. However, the box where self-hosted-engine is running is a physical server but I am looking to run ansible from my local machine instead to manage vms running on engineVM. Is there a way to achieve this?
Sure you can use your own computer to manage the VMs.
In your playbook you just need to specify group/host where the tasks of the playbook should run.
So if using the ovirt4.py script as your inventory file, you need to just specify specific group where you want to run the tasks in your playbook like this:
- hosts: tag_httpd tasks: ...
If you want to Create/Delete VMs using ovirt_* modules, you can do it from your computer as well, but you need to install Python SDK version 4. You can download it from pip using following command: pip install ovirt-engine-sdk-python.
Thank you in advance.
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org

Hi, you can use multiple different inventory sources at the same time - so use your file + ovirt4.py https://docs.ansible.com/ansible/2.5/user_guide/intro_dynamic_inventory.html... Best regards Martin Sivak On Tue, May 22, 2018 at 9:50 AM, Sumit Bharadia <03ce007@gmail.com> wrote:
Thanks.
Is there a way to use an existing inventory file?
I asked because the server where the engineVM is running is listed into my existing a ansible inventory file on my local machine, but how do I specify/run the subsequent tasks which I want to run on vms running on engineVM as I don't see the /etc/hosts file updated where engineVM runs. How would my local ansible playbook know which vms are available, etc?
On Tue, 22 May 2018, 8:36 am Ondra Machacek, <omachace@redhat.com> wrote:
On 05/21/2018 11:51 AM, 03ce007@gmail.com wrote:
I have a self-hosted-engine (4.2) running on a centos 7.4 server.
I have downloaded ovirt ansible roles from ansible-galaxy and can run them from the server where the engineVM is running and able to deploy new vms, clusters, dc, etc.
I have seen the use of ovirt4.py file to target and group hosts which you can target for specific plays. However, the box where self-hosted-engine is running is a physical server but I am looking to run ansible from my local machine instead to manage vms running on engineVM. Is there a way to achieve this?
Sure you can use your own computer to manage the VMs.
In your playbook you just need to specify group/host where the tasks of the playbook should run.
So if using the ovirt4.py script as your inventory file, you need to just specify specific group where you want to run the tasks in your playbook like this:
- hosts: tag_httpd tasks: ...
If you want to Create/Delete VMs using ovirt_* modules, you can do it from your computer as well, but you need to install Python SDK version 4. You can download it from pip using following command: pip install ovirt-engine-sdk-python.
Thank you in advance.
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org

Thank you. I am running a self-hosted engineVM, and having difficulty connecting the dots so ansible can talk to vms within the self-hosted engineVM. Below is my setup- inventory dir with files *cat ~/ansible/inventory/prod/hosts* [ovirt] ovirt 192.168.1.100 *cat ~/ansible/inventory/prod/ovirt.ini* [ovirt] ovirt_url = https://*engine.ovirt/*ovirt-engine/api # this is self hosted engine. so invoking ./ovirt4.py fails with http error as physical host is 'ovirt' but self-hosted-engine fqdn is 'engine.ovirt' ovirt_username = admin@internal ovirt_password = password ovirt_ca_file = ca.pem . # this sits on my local machine running ovirt4.py standalone fails as mentioned above. *cat ~/ansible/playbook.yml* --- name: Talk to self-hosted-engine server hosts: ovirt tasks: - name: Hello server debug: msg: Hello server --- name: Talk to self-hosted-engine VM hosts: status_up tasks: - name: Hello vms debug: msg: Hello vms *ansible-playbook -i ~/ansible/inventories/prod playbook.yml # prod folder has .ini, .py and static hosts file as above* PLAY [Talk to self-hosted-engine server] ********************************************************************************************** TASK [Gathering Facts] **************************************************************************************************************** ok: [ovirt] TASK [Hello server] ******************************************************************************************************************* ok: [ovirt] => { "msg": "Hello server" } [WARNING]: Could not match supplied host pattern, ignoring: status_up PLAY [Talk to self-hosted-engine VM] ************************************************************************************************** *skipping: no hosts matched* PLAY RECAP **************************************************************************************************************************** ovirt : ok=2 changed=0 unreachable=0 failed=0 Is there something i am missing? On 22 May 2018 at 10:25, Martin Sivak <msivak@redhat.com> wrote:
Hi,
you can use multiple different inventory sources at the same time - so use your file + ovirt4.py
https://docs.ansible.com/ansible/2.5/user_guide/intro_ dynamic_inventory.html#using-inventory-directories-and- multiple-inventory-sources
Best regards
Martin Sivak
On Tue, May 22, 2018 at 9:50 AM, Sumit Bharadia <03ce007@gmail.com> wrote:
Thanks.
Is there a way to use an existing inventory file?
I asked because the server where the engineVM is running is listed into my existing a ansible inventory file on my local machine, but how do I specify/run the subsequent tasks which I want to run on vms running on engineVM as I don't see the /etc/hosts file updated where engineVM runs. How would my local ansible playbook know which vms are available, etc?
On Tue, 22 May 2018, 8:36 am Ondra Machacek, <omachace@redhat.com> wrote:
On 05/21/2018 11:51 AM, 03ce007@gmail.com wrote:
I have a self-hosted-engine (4.2) running on a centos 7.4 server.
I have downloaded ovirt ansible roles from ansible-galaxy and can run them from the server where the engineVM is running and able to deploy
new
vms, clusters, dc, etc.
I have seen the use of ovirt4.py file to target and group hosts which you can target for specific plays. However, the box where self-hosted-engine is running is a physical server but I am looking to run ansible from my local machine instead to manage vms running on engineVM. Is there a way to achieve this?
Sure you can use your own computer to manage the VMs.
In your playbook you just need to specify group/host where the tasks of the playbook should run.
So if using the ovirt4.py script as your inventory file, you need to just specify specific group where you want to run the tasks in your playbook like this:
- hosts: tag_httpd tasks: ...
If you want to Create/Delete VMs using ovirt_* modules, you can do it from your computer as well, but you need to install Python SDK version 4. You can download it from pip using following command: pip install ovirt-engine-sdk-python.
Thank you in advance.
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org
_______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org
participants (4)
-
03ce007@gmail.com
-
Martin Sivak
-
Ondra Machacek
-
Sumit Bharadia