I have integrated packer with azure DevOps pipeline. Currently this packer is being utilized for patch deployments through SCCM. But there are few patches which need VM to reboot for corresponding patches installation, If we add reboot command[Restart-Computer] within PowerShell script which is been called by packer provisioner, packer pipeline is failing out. Can someone help here please!
Related
I'm bit stuck lately, because i've started to learn about CI/CD with Gitlab. I'm interested in developing a pipeline for my vagrant development with virtualbox. I'm new to Gitlab CE, but I see there is a virtualbox executor. What would be the proper way to test a vagrant automation? Find below my developement environment:
Local Vagrant Virtualzation running Virtualbox with a private network (Host-Machine: Windows 10 Laptop)
Self-hosted Gitlab CE instance (Host-Machine: Ubuntu Server connected to LAN)
Gitlab-Runner running as a docker-service on the same machine as the Gitlab CE
My questions:
Is it possible for the gitlab-runner to connect to my local vagrant machine using Virtualbox Executor?
Any experiences/references i can read how to develop a CI/CD Pipeline for Vagrant?
Should I have a clone of Vagrant/Virtualbox on my Ubuntu Server in order to get this running?
Much love for your help
I'd like set up a development Vagrant VM using the same could-config file I'd use to provision a production VM. Vagrant doesn't have a built-in cloud-init/cloud-config provisioner, though. Is there still some way to do that?
Cloud-Init is not nativelly supported on Vagrant box images, instead the included vagrant provision do the job.
However there is a way to do it with VirtualBox
Install from scratch a VM using the distro ISO
Install cloud-init on the VM.
Stop and convert the VM to template.
Then the deployment of a new VM
Save the user-data and meta-data as an iso file
Clone the template and start it with the iso attached
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).
I'm trying to understand if there is the possibility to develop a vagrant plugin that permits through the vagrantfile to attach custom beahviours to vm events, such the execution of shell commands.
For example a vagrant rsync after a command like composer install has been run on the virtual machine.
Any ideas?
You can use the vagrant-triggers
plugin
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