Once Ansible is installed, we can run ansible-playbook with the -connnection-local switch to run out playbook, setup.yml in my case.Īt this point, it’s all standard Ansible all the way for your provisioning. Installation is easy enough: we just use apt-get to add install what we need (quietly!) from the ansible ppa as per the docs. Obviously, we only want to install Ansible once, so we check the output of dpkg-query and only install if it’s not already installed. If Īpt-get install -qq software-properties-common &> /dev/null || exit 1Īpt-add-repository ppa:ansible/ansible &> /dev/null || exit 1Īpt-get install -qq ansible &> /dev/null || exit 1Īnsible-playbook setup.yml -connection=local Our shell provisioner needs to do two things: ![]() Now, all that is required is to provide an Ansible playbook.yml file and here one would define any particular configuration or software that needs to be set up on the guest OS. To get rid of this, we need to configure Vagrant’s ssh shell to be a non-login one in the Vagrantfile:Ĭ = "bash -c 'BASH_ENV=/etc/profile exec bash'" The City of Ninnescah is located in the State of Kansas. For this we opted to leverage Vagrant’s ansiblelocal that works by installing Ansible in the guest on the fly and running provisioning locally. This is due to the way Ubuntu tries to echo a message to a shell that isn’t interactive. The code used to create a Kubernetes Cluster with Vagrant and Ansible is composed of.vagrant/: hidden directory for Vagrant tracking. I immediately noticed a warning when running vagrant up: “stdin: is not a tty error”. This simply tells Vagrant to run init.sh which is stored in the provisioning directory of my project. :inline => "export PYTHONUNBUFFERED=1 & export ANSIBLE_FORCE_COLOR=1 & cd /vagrant/provisioning &. Use the Shell provisionerĪs we’re running Ansible on the guest, we use the shell provisioner, so my Vagrantfile contains: These are the steps when starting from the ubuntu/trusty64 base box. Rather than migrate what I’d done to Puppet, Evan recommended that I look into running Ansible on the guest instead and provided some hints. ![]() Firstly, I played with the Ansible provisioner, but found it a little slow and then I realised that Ansible doesn’t run on Windows. I’ve been setting up a Vagrant VM for use with some client projects and picked Ansible to do this. Ansible, Terraform and Vagrant are common infrastructure automation platforms with specific use cases, benefits and drawbacks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |