Ansible Playbook to create an unattended install of Ubuntu in VM - ansible

I've been trying to create a playbook to do an unattended install of Ubuntu server 18.04.2 using an iso on VmWare.
The playbook will actually create the instance but stops and waits for user input to select the language, keyboard config, etc.
How can I get ansible/vmware to use a preseed.cfg file to set those options so I can create an unattended install?
Thanks!

You might be starting with the wrong tool.
Eventually, you will use Ansible, but calling it from Packer.
Start here: https://github.com/geerlingguy/packer-boxes

Related

How to run Ansible playbooks on Redhat Linux from Windows CLI?

I have a project where I have a cluster of Linux Redhat hosts, however I want to run a playbook through my Windows Command Prompt. I have checked out the documentation on their official website, but I didn't see much about my approach. I know it may not be conventional or smart to run it from a Windows CLI but I want to see if I could do it. I tried one line of code below:
Command:
ansible-playbook -i hosts playbook.yml
Using a stock windows machine as a control node is not supported.
There are however 2 options that will let you run ansible from windows:
Running from cygwin
Running from wsl (windows 10).

Use Windows with Virtual Box as Host and VM guest for managing with Vagrant and Ansible

Is there a way for next scenario as I am planing to setup lab environment:
physical desktop running Windows 8 platform
on Windows 8, I plan to install ONLY Virtual Box 5.1
then on VirtualBox to setup CentOS system
and then on CentOS will be running Vagrant and Ansible (no VirtualBox installation)
Question: Is there any way that this setup will work to create new environments via CentOS as Vagrant-Ansible manage servers?
------------------------edit----------------------
Thank you for your answer. I try to setup as I mentioned above without luck. I am new user of Vagrant and Ansible so I am having trouble to make it work. I setup Linux system on VB, install vagrant, install Ansible but when I hit 'vagrant up' I am getting error that "No usable default provider could be found for your". I am following documentation form official sites but can;t make it work. Then I try to install VirtualBox inside Linux system and now it is working but defined machines with Vagrant installs inside Linux machine (where are Vagrant and Ansible installed) and not on Host VirtualBox. Any advice? I hope it is clearer now. Thanks
I have had some success in using a Windows Ansible Host and running using Vagrant with this host.
I have scripted how to setup Win Ansible and the shims at:
https://github.com/taliesins/win-ansible
The important bit is to setup shims that call bash scripts running under cygwin.
Another important thing to consider is, is that it is probably better to generate your own inventory file (put it in the vagrant file before you create VMs) then to use an auto-generated inventory file.
If you environment is not simple consider not using Vagrant provisioner for Ansible, but rather call Ansible via command line at the end of the vagrant file (after you have created the VMs).

How to install ansible-playbook on windows as host with vagrant

I am trying to orchestrate server with LEMP stack and other configuration. For this I'm using vagrant to up(manage) servers and Ansible for auto configuration and package installations. I'm using windows as host machine where ansible need to be installed and all *Nix machine would be guest which are going to be configured.
With pip I have successfully installed ansible in C:\Python27\Scripts
I am facing Problem in running ansible and ansible-playbook on windows. If any one has done this for windows machine, Please share article or way to accomplish.
http://www.azavea.com/blogs/labs/2014/10/running-vagrant-with-ansible-provisioning-on-windows/
I had gone through above article but its not working, Error
==> default: Running provisioner: ansible...
zsh:1: no such file or directory: /bin/ansible-playbook
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
In *Nix as guest all working excellent. But looking for support to do same in windows machine.
Using windows as the control machine is not supported. But you can have a pleasant experience using docker with boot2docker.
This will install a virtualbox VM guest on the windows machine, which you will be able to use to configure you vagrant boxes, for which you will have to configure the networking properly.
You can achieve this with cygwin. For scripts to do this have a look at:
https://github.com/taliesins/win-ansible
As an added bonus it adds the shims required to use Ansible from windows command prompt and from Vagrant.
From the documentation:
Currently Ansible can be run from any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher) installed. Windows isn’t supported for the control machine.
Generally speaking, if you are using a Windows host, you have 3 options. Listed in order of (my) preference:
Run Ansible from a Docker container
Run Ansible from WSL (if you're running on Windows 10). This Gist can help you with some further setup so that you don't have to invoke WSL to run Ansible.
Run Ansible from Cygwin

Windows 8 HOST Vagrant spinup GUEST Ubuntu dev followed with Ansible manage dev stack from GUEST

I am working with Vagrant to provision Ubuntu servers using bash. I would like to cut my teeth on Ansible however I understand that Ansible does not currently run on Windows Host.
Is something like the following a reasonable work-around?
On Windows Host, use Vagrant to spin-up a basic Ubuntu Dev Box, including Ansible tools. From the Guest Dev Box use Ansible to run local tasks to further build it out. From the Dev Box I would use Ansible to spin-up/manage other Digital Ocean droplets from this Dev Box.
Your easiest workaround is probably to use virtualbox to start a linux/ubuntu virtual running on your Windows box, then to run Vagrant inside of that virtual. Yes, it's turtles all the way down- windows running virtualbox+ubuntu running virtualbox+ubuntu+vagrant.
Of course, the first layer won't be managed by Vagrant or Ansible, though you could do most of the configuration management after bootstrapping it.
Another option is to have a small dev box in your virtual hosting provider (Digital Ocean) where you manually install and launch vagrant/ansible from.
Alternately, dual boot or switch to a Linux or OSX machine :)

Run a windows xp bat script remotely from a ubuntu machine

Is it possible to run a windows xp bat script remotely from a ubuntu machine via command line?
This is possible if you have an ssh server running on the WinXP machine. It is trivial to set up such a server if you have installed Cygwin. This is well described here.
Then from an Ubuntu command line (or cron job) you run
ssh user#winxp command
Make sure your .bat has executable permissions.
I think that the technology you are after is WMI. I see that there is an ubuntu package called wmi-client, which you can sudo apt-get install and attempt to you. Some quick searches and I'm unable to find details, but maybe that will get you somewhere....
You would probably use something like remote desktop, and if you did it that way, it would work, but your question isn't very specific

Resources