Testing¶
Test Ansible with Vagrant¶
Install Vagrant¶
You need to install Vagrant. See the following links for details:
- https://docs.ansible.com/ansible/latest/scenario_guides/guide_vagrant.html
- https://www.vagrantup.com/intro/getting-started/index.html
- https://blog.scriptmyjob.com/creating-an-ansible-testing-environment-using-vagrant-on-macos/
In short, you can install Vagrant on macOS with Homebrew (and Homebrew Cask):
$ brew cask install virtualbox
$ brew cask install vagrant
You need Ansible locally installed:
$ conda install -c conda-forge ansible
OR
$ brew install ansible # macOS only
Install Ansible roles:
$ ansible-galaxy install -p roles -r requirements.yml --ignore-errors
Run Vagrant¶
Use Vagrant config:
$ ln -s etc/sample-vagrant.yml custom.yml
Initial setup:
$ vagrant up
Provision with Ansible again:
$ vagrant provision
Login with SSH:
$ vagrant ssh
Run Ansible manually:
$ ansible-playbook -i .vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory playbook.yml
Remove VMs:
$ vagrant destroy -f
Try WPS requests¶
Run a WPS GetCapabilites request:
$ curl -s -o caps.xml \
"http://192.168.128.100:5000/wps?service=WPS&request=GetCapabilities"
$ less caps.xml
Alternative: use Vagrant without provisioning¶
Use Vagrant without provisioning and just to setup a new VM:
$ vagrant destroy -f # remove previous VM
$ vagrant up --no-provision # setup new VM
$ vagrant ssh # ssh into VM
Run the installation manually now:
vagrant> sudo yum install git
vagrant> cd /vagrant
vagrant> sudo yum install epel-release
vagrant> sudo yum install ansible
vagrant> ln -s etc/sample-vagrant.yml custom.yml
vagrant> ansible-galaxy install -r requirements.yml
vagrant> ansible-playbook -c local -i hosts playbook.yml