install guest OS using virt module

322 views
Skip to first unread message

Kai

unread,
Jul 12, 2016, 6:20:17 PM7/12/16
to ansible...@googlegroups.com
Dear all!

Does a kind soul have a pointer for me to a more detailed documentation
of the virt module or of handling libvirt VMs in general?

I can define a VM, I should be able to start/stop it. What I didn't
figure out yet is how to install the initial OS on the VM (from a
playbook, of course).

Cheers, Kai
--
"Das ist Demokratie, wenn man sich aussuchen darf, wer einen verarscht."
(Hagen Rether)
D-55118 Meenz fast: kai_pf (aT] web(dot)de
++ PGP Key fingerprint B567 C43E 99D1 7709 7D64 3BF8 2DE8 1092 0EEF D58E ++
-----BEGIN GEEK CODE BLOCK-----
VERSION: 3.12
GCS/IT/CM d- s:- a+>-----(?) C++$ UL++(++++$) P+++ L++ E-(+) W--(+) N
!w---($) !O !M V? PS+ PE-() Y+ PGP(+) t R*@ tv--@ b+>++ DI++ G e+++(*) h? y?
------END GEEK CODE BLOCK------


Mark Janssen

unread,
Jul 13, 2016, 8:21:25 AM7/13/16
to ansible...@googlegroups.com
You can run a kickstart or preseed installation, import disk-images or do various other things... For example see (an old version) of my provisioning config:


These days I use something a bit different, which isn't in a releasable form at this time.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/1468361628.5583.9.camel%40wintermute.
For more options, visit https://groups.google.com/d/optout.



--
Mark Janssen  --  maniac(at)maniac.nl
Unix / Linux Open-Source and Internet Consultant
Maniac.nl Sig-IO.nl Vps.Stoned-IT.com

Toshaan Bharvani | VanTosh

unread,
Jul 13, 2016, 8:25:50 AM7/13/16
to ansible...@googlegroups.com

On 13/07/16 14:21, Mark Janssen wrote:
> You can run a kickstart or preseed installation, import disk-images or
> do various other things... For example see (an old version) of my
> provisioning config:
>
> https://github.com/sigio/sigio-provisioning
Here is the one I use :
https://github.com/toshywoshy/ansible-role-vminstaller
It is a role so you can import it into your structure.

I still need to push some updates and I have added support for Ubuntu,
not yet in the repo, but it gives you a clear idea how to set it up.
> <mailto:ansible-project%2Bunsu...@googlegroups.com>.
> To post to this group, send email to
> ansible...@googlegroups.com
> <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/1468361628.5583.9.camel%40wintermute.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Mark Janssen -- maniac(at)maniac.nl <http://maniac.nl>
> Unix / Linux Open-Source and Internet Consultant
> Maniac.nl Sig-IO.nl Vps.Stoned-IT.com <http://Vps.Stoned-IT.com>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ansible-proje...@googlegroups.com
> <mailto:ansible-proje...@googlegroups.com>.
> To post to this group, send email to ansible...@googlegroups.com
> <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAKs9msgkdE%2BfO9QrObPibs%2B%2BpaOEa%3DWi0T8vug_mONrKsGne8g%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAKs9msgkdE%2BfO9QrObPibs%2B%2BpaOEa%3DWi0T8vug_mONrKsGne8g%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--

--
Toshaan Bharvani
+32-(0)476-66.70.55
tos...@vantosh.com
--
__ __ _____ _
\ \ / /_ _ _ _|_ _|__ ___| |__
\ \ / / _` | '_ \| |/ _ \/ __| '_ \
\ V / (_| | | | | | (_) \__ \ | | |
\_/ \__,_|_| |_|_|\___/|___/_| |_|

http://www.vantosh.com

Quinten Matsijslei 38 bus 20
B-2018 Antwerpen, Belgium
--

Kai

unread,
Jul 13, 2016, 9:28:06 AM7/13/16
to ansible...@googlegroups.com
Mark, Toshaan,

thanks for your answers.
So it's not possible using only the provided modules, you have to invoke
shell commands as well.
You both use a module "qemu-img" which doesn't seem to be provided with
ansible by default!?

Thanks & cheers, Kai

Toshaan Bharvani | VanTosh

unread,
Jul 13, 2016, 10:22:50 AM7/13/16
to ansible...@googlegroups.com
Kai,


On 13/07/16 15:27, Kai wrote:
> Mark, Toshaan,
>
> thanks for your answers.
> So it's not possible using only the provided modules, you have to invoke
> shell commands as well.
Well, it should be possible, with the virt module, run a install XML and
then run the post install XML, then you would only use the template and
the virt module, however since the virt-install module does this much
better and I haven't figured a way how to write an acceptable and nice
virt-install ansible module, I use a shell script


> You both use a module "qemu-img" which doesn't seem to be provided with
> ansible by default!?
Yes, this module was not accepted by Michael very long time ago.
I just created a PR, let's see if we can get it in now.
In the mean time if you require it, you can find it at :
https://raw.githubusercontent.com/toshywoshy/ansible-vm-install/master/playbooks/library/qemu-img
, this is my old vm install playbook

>
> Thanks & cheers, Kai
>
Regards,
Toshaan.
Reply all
Reply to author
Forward
0 new messages