Ansible: Vagrant: allow passing ansible tags to vagrant provision

Creating a cluster from scratch takes about 7 minutes. But if you just
rebuild the binaries and want to update those you don't want to have to
rerun the entire thing. There is an ansible tag 'binary-update' which
will do that. Now one can do
```
ANSIBLE_TAGS=binary-update vagrant provision
```
And it will push the new binaries.
pull/6/head
Eric Paris 2015-07-16 12:51:56 -04:00
parent 8ba4d85fa9
commit a25b34e1a4
2 changed files with 17 additions and 7 deletions

View File

@ -56,4 +56,10 @@ vagrant provision
### VirtualBox ### VirtualBox
Nothing special with VirtualBox. Hopefully `vagrant up` just works. Nothing special with VirtualBox. Hopefully `vagrant up` just works.
## Random Information
If you just want to update the binaries on your systems (either pkgManager or localBuild) you can do so using the ansible binary-update tag. To do so with vagrant provision you would need to run
```
ANSIBLE_TAGS="binary-update" vagrant provision
```
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/contrib/ansible/vagrant/README.md?pixel)]() [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/contrib/ansible/vagrant/README.md?pixel)]()

View File

@ -8,6 +8,7 @@ require "yaml"
require 'vagrant-openstack-provider' require 'vagrant-openstack-provider'
$num_nodes = (ENV['NUM_NODES'] || 2).to_i $num_nodes = (ENV['NUM_NODES'] || 2).to_i
ansible_tags = ENV['ANSIBLE_TAGS']
VAGRANTFILE_API_VERSION = "2" VAGRANTFILE_API_VERSION = "2"
@ -119,6 +120,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
n.vm.hostname = name n.vm.hostname = name
set_provider(n) set_provider(n)
if ansible_tags.nil?
# This set up the vagrant hosts before we run the main playbook # This set up the vagrant hosts before we run the main playbook
# Today this just creates /etc/hosts so machines can talk via their # Today this just creates /etc/hosts so machines can talk via their
# 'internal' IPs instead of the openstack public ip. # 'internal' IPs instead of the openstack public ip.
@ -127,12 +129,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
ansible.playbook = "./vagrant-ansible.yml" ansible.playbook = "./vagrant-ansible.yml"
ansible.limit = "all" #otherwise the metadata wont be there for ipv4? ansible.limit = "all" #otherwise the metadata wont be there for ipv4?
end end
end
# This sets up both flannel and kube. # This sets up both flannel and kube.
n.vm.provision :ansible do |ansible| n.vm.provision :ansible do |ansible|
ansible.groups = groups ansible.groups = groups
ansible.playbook = "../cluster.yml" ansible.playbook = "../cluster.yml"
ansible.limit = "all" #otherwise the metadata wont be there for ipv4? ansible.limit = "all" #otherwise the metadata wont be there for ipv4?
ansible.tags = ansible_tags
end end
end end
end end