Ansible/Yeti
From charlesreid1
Walkthrough of creating an Ansible playbook for yeti.
a) found pyenv playbook online. use this.
b) flailing with vagrant.
Setup
Before we start, we want to have the following:
- repository where our playbook will go (https://github.com/charlesreid1/dahak-yeti)
- Vagrantfile for running vagrant machines for testing our playbook
Vagrantfile
Here we give a Vagrantfile that will start three separate nodes. This is important to test yeti's ability to handle multiple machines.
Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Use the same key for each machine
config.ssh.insert_key = false
config.vm.define "vagrant1" do |vagrant1|
vagrant1.vm.box = "ubuntu/xenial64"
vagrant1.vm.network "forwarded_port", guest: 80, host: 8877
vagrant1.vm.network "forwarded_port", guest: 443, host: 7443
end
config.vm.define "vagrant2" do |vagrant2|
vagrant2.vm.box = "ubuntu/xenial64"
vagrant2.vm.network "forwarded_port", guest: 80, host: 8878
vagrant2.vm.network "forwarded_port", guest: 443, host: 7444
end
config.vm.define "vagrant3" do |vagrant3|
vagrant3.vm.box = "ubuntu/xenial64"
vagrant3.vm.network "forwarded_port", guest: 80, host: 8879
vagrant3.vm.network "forwarded_port", guest: 443, host: 7445
end
end
Also see Ansible/Vagrant.
Inventory file
Info for the inventory file (port numbers) can be obtained with:
vagrant ssh-config
The corresponding inventory file looks like this:
[servers] vagrant1 ansible_host=127.0.0.1 ansible_port=2222 vagrant2 ansible_host=127.0.0.1 ansible_port=2201 vagrant3 ansible_host=127.0.0.1 ansible_port=2202