Update Ansible support

Update Ansible support across several different areas

Signed-off-by: Scott Lowe <scott.lowe@scottlowe.org>
This commit is contained in:
Scott Lowe 2018-03-11 21:43:51 -06:00
parent 75c4afcd38
commit 99b6fcc833
No known key found for this signature in database
GPG key ID: 949F43F6E6C11780
11 changed files with 10 additions and 10 deletions

View file

@ -77,7 +77,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Provision the VM with Ansible
config.vm.provision 'ansible' do |ansible|
ansible.playbook = 'provision.yml'
ansible.playbook = 'ansible.yml'
end # config.vm.provision
end # machines.each
end # Vagrant.configure

View file

@ -6,6 +6,8 @@ These files were created to allow users to use Vagrant ([http://www.vagrantup.co
* **ansible.cfg**: This Ansible configuration file tells Ansible which inventory file to use (a file named `hosts` in the current directory), which SSH private key to use (the default Vagrant insecure key), and which remote user to use (the default user of `vagrant` that should be common to all Vagrant boxes). No edits to this file should be necessary.
* **ansible.yml**: This is the Ansible playbook that will configure the Vagrant VMs to become members of a Consul cluster. No edits to this file should be necessary.
* **config.json.j2**: This Jinja2 template is automatically filled in with appropriate values by Ansible when the Ansible playbook is applied against the Vagrant VMs. No edits to this file should be necessary.
* **consul.conf**: This Upstart script configures Consul to run as a background daemon (service) on the Ubuntu-based VMs created by Vagrant. This file is installed by Ansible when the Ansible playbook is applied against the Vagrant VMs. No edits to this file should be necessary.
@ -14,8 +16,6 @@ These files were created to allow users to use Vagrant ([http://www.vagrantup.co
* **machines.yml**: This YAML file contains a list of VM definitions. It is referenced by `Vagrantfile` when Vagrant instantiates the VMs. Generally, the only change needed to this file is to specify the correct Vagrant box you will be used (see "Instructions" below). If necessary, you may need to edit the IP addresses supplied in this file to avoid IP addressing conflicts with other networks.
* **provision.yml**: This is the Ansible playbook that will configure the Vagrant VMs to become members of a Consul cluster. No edits to this file should be necessary.
* **README.md**: This file you're currently reading.
* **Vagrantfile**: This file is used by Vagrant to spin up the virtual machines. This file is fairly extensively commented to help explain what's happening. You should be able to use this file unchanged; all the VM configuration options are stored outside this file.
@ -32,7 +32,7 @@ These instructions assume you've already installed VMware Fusion, Vagrant, the V
4. Once you have edited `machines.yml`, use `vagrant up` to bring up the 3 systems that will serve as your Consul cluster.
5. Once Vagrant has finished bringing up the VMs, run `ansible-playbook provision.yml`. Ansible will use the configuration file in the current directory to pull inventory from the file named `hosts` (it was automatically generated when you ran `vagrant up`). This will provision and configure Consul on each of the Vagrant VMs.
5. Once Vagrant has finished bringing up the VMs, run `ansible-playbook ansible.yml`. Ansible will use the configuration file in the current directory to pull inventory from the file named `hosts` (it was automatically generated when you ran `vagrant up`). This will provision and configure Consul on each of the Vagrant VMs.
**NOTE**: Due to the way the Ansible provisioner in Vagrant works, it's currently not possible to provision the VMs with Ansible from within the `Vagrantfile`. As a result, step #5 (running `ansible-playbook` manually) is needed.

View file

@ -6,12 +6,12 @@ These files were created to allow users to use Vagrant ([http://www.vagrantup.co
* **ansible.cfg**: This Ansible configuration file instructs Ansible to use an inventory file named `hosts` in the current directory, and to use the default vagrant user (`vagrant`) and default insecure Vagrant SSH private key.
* **ansible.yml**: This YAML file is an Ansible playbook that configures the VMs created by Vagrant when they are first provisioned. Ansible is called automatically by Vagrant; you do not need to invoke Ansible separately. No changes are needed to this file.
* **hosts**: This file is created automatically when you run `vagrant status` or `vagrant up` (anytime Vagrant processes `Vagrantfile`). This file relies on the presence of a "ip_addr" value in `machines.yml`. Do not edit this file directly---instead edit `machines.yml` to change the values that will be automatically written into this file.
* **machines.yml**: This YAML file contains a list of VM definitions and associated configuration data. It is referenced by `Vagrantfile` when Vagrant instantiates the VMs. Only minimal changes may be needed to this file; see the "Instructions" section below.
* **provision.yml**: This YAML file is an Ansible playbook that configures the VMs created by Vagrant when they are first provisioned. Ansible is called automatically by Vagrant; you do not need to invoke Ansible separately. No changes are needed to this file.
* **README.md**: The file you're currently reading.
* **Vagrantfile**: This file is used by Vagrant to spin up the virtual machines. This file is fairly extensively commented to help explain what's happening. You should be able to use this file unchanged; all the VM configuration options are stored outside this file.

View file

@ -57,7 +57,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Provision the VM with Ansible
config.vm.provision 'ansible' do |ansible|
ansible.playbook = 'provision.yml'
ansible.playbook = 'ansible.yml'
end # config.vm.provision
end # machines.each
end # Vagrant.configure

View file

@ -8,7 +8,7 @@ These files show an example of how to use Packer ([https://www.packer.io/](https
## Contents
* **provision.yml**: This Ansible playbook applies the "docker-ce-edge" role to the AMI being created by Packer, and is called by `template.json`.
* **ansible.yml**: This Ansible playbook applies the "docker-ce-edge" role to the AMI being created by Packer, and is called by `template.json`.
* **README.md**: This file you're currently reading.

View file

@ -33,7 +33,7 @@
"provisioners": [
{
"type": "ansible",
"playbook_file": "provision.yml"
"playbook_file": "ansible.yml"
}
]
}

View file

@ -64,7 +64,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Provision the VM with Ansible
config.vm.provision 'ansible' do |ansible|
ansible.playbook = 'provision.yml'
ansible.playbook = 'ansible.yml'
end # config.vm.provision
end # machines.each
end # Vagrant.configure