Vagrant fixes
- added more machines - fixed ssh key paths (works for me with Vagrant 1.7.2) - added data_container/echo.yml ansbile job to test ansible ssh
This commit is contained in:
parent
3cbbf457a1
commit
a9d2ca73a2
45
Vagrantfile
vendored
45
Vagrantfile
vendored
@ -18,11 +18,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.define "solar-dev", primary: true do |guest1|
|
||||
guest1.vm.provision "shell", inline: init_script, privileged: true
|
||||
guest1.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "/vagrant/tmp/keys/ssh_private"
|
||||
guest1.vm.provision "file", source: "ansible.cfg", destination: "/home/vagrant/.ansible.cfg"
|
||||
guest1.vm.network "private_network", ip: "10.0.0.2"
|
||||
guest1.vm.host_name = "solar-dev"
|
||||
|
||||
guest1.vm.provider :virtualbox do |v|
|
||||
v.customize ["modifyvm", :id, "--memory", 2048]
|
||||
v.customize ["modifyvm", :id, "--memory", 256]
|
||||
v.name = "solar-dev"
|
||||
end
|
||||
end
|
||||
@ -32,9 +33,49 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
guest2.vm.host_name = "solar-dev2"
|
||||
|
||||
guest2.vm.provider :virtualbox do |v|
|
||||
v.customize ["modifyvm", :id, "--memory", 1024]
|
||||
v.customize ["modifyvm", :id, "--memory", 256]
|
||||
v.name = "solar-dev2"
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "solar-dev3" do |guest3|
|
||||
guest3.vm.network "private_network", ip: "10.0.0.4"
|
||||
guest3.vm.host_name = "solar-dev3"
|
||||
|
||||
guest3.vm.provider :virtualbox do |v|
|
||||
v.customize ["modifyvm", :id, "--memory", 256]
|
||||
v.name = "solar-dev3"
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "solar-dev4" do |guest4|
|
||||
guest4.vm.network "private_network", ip: "10.0.0.5"
|
||||
guest4.vm.host_name = "solar-dev4"
|
||||
|
||||
guest4.vm.provider :virtualbox do |v|
|
||||
v.customize ["modifyvm", :id, "--memory", 256]
|
||||
v.name = "solar-dev4"
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "solar-dev5" do |guest5|
|
||||
guest5.vm.network "private_network", ip: "10.0.0.6"
|
||||
guest5.vm.host_name = "solar-dev5"
|
||||
|
||||
guest5.vm.provider :virtualbox do |v|
|
||||
v.customize ["modifyvm", :id, "--memory", 256]
|
||||
v.name = "solar-dev5"
|
||||
end
|
||||
end
|
||||
|
||||
config.vm.define "solar-dev6" do |guest6|
|
||||
guest6.vm.network "private_network", ip: "10.0.0.7"
|
||||
guest6.vm.host_name = "solar-dev5"
|
||||
|
||||
guest6.vm.provider :virtualbox do |v|
|
||||
v.customize ["modifyvm", :id, "--memory", 256]
|
||||
v.name = "solar-dev6"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
2
ansible.cfg
Normal file
2
ansible.cfg
Normal file
@ -0,0 +1,2 @@
|
||||
[defaults]
|
||||
host_key_checking = False
|
@ -9,31 +9,31 @@ resources:
|
||||
model: x/resources/ro_node/
|
||||
args:
|
||||
ip: 10.0.0.3
|
||||
ssh_key: /vagrant/tmp/keys/ssh_private
|
||||
ssh_key: /vagrant/.vagrant/machines/solar-dev2/virtualbox/private_key
|
||||
ssh_user: vagrant
|
||||
- name: node2
|
||||
model: x/resources/ro_node/
|
||||
args:
|
||||
ip: 10.0.0.4
|
||||
ssh_key: /vagrant/tmp/keys/ssh_private
|
||||
ssh_key: /vagrant/.vagrant/machines/solar-dev3/virtualbox/private_key
|
||||
ssh_user: vagrant
|
||||
- name: node3
|
||||
model: x/resources/ro_node/
|
||||
args:
|
||||
ip: 10.0.0.5
|
||||
ssh_key: /vagrant/tmp/keys/ssh_private
|
||||
ssh_key: /vagrant/.vagrant/machines/solar-dev4/virtualbox/private_key
|
||||
ssh_user: vagrant
|
||||
- name: node4
|
||||
model: x/resources/ro_node/
|
||||
args:
|
||||
ip: 10.0.0.6
|
||||
ssh_key: /vagrant/tmp/keys/ssh_private
|
||||
ssh_key: /vagrant/.vagrant/machines/solar-dev5/virtualbox/private_key
|
||||
ssh_user: vagrant
|
||||
- name: node5
|
||||
model: x/resources/ro_node/
|
||||
args:
|
||||
ip: 10.0.0.7
|
||||
ssh_key: /vagrant/tmp/keys/ssh_private
|
||||
ssh_key: /vagrant/.vagrant/machines/solar-dev6/virtualbox/private_key
|
||||
ssh_user: vagrant
|
||||
|
||||
- name: mariadb_keystone1_data
|
||||
|
3
main.yml
3
main.yml
@ -12,6 +12,9 @@
|
||||
- apt: name=ipython state=present
|
||||
- apt: name=python-pudb state=present
|
||||
|
||||
# requirements
|
||||
- shell: pip install -r /vagrant/requirements.txt
|
||||
|
||||
# Graph drawing
|
||||
- apt: name=python-matplotlib state=present
|
||||
|
||||
|
@ -9,6 +9,8 @@ class Ansible(BaseHandler):
|
||||
def action(self, resource, action_name):
|
||||
inventory_file = self._create_inventory(resource)
|
||||
playbook_file = self._create_playbook(resource, action_name)
|
||||
print 'inventory_file', inventory_file
|
||||
print 'playbook_file', playbook_file
|
||||
subprocess.call(['ansible-playbook', '-i', inventory_file, playbook_file])
|
||||
|
||||
#def _get_connection(self, resource):
|
||||
@ -23,6 +25,7 @@ class Ansible(BaseHandler):
|
||||
print user
|
||||
print ssh_key
|
||||
inventory = inventory.format(host, host, user, ssh_key)
|
||||
print inventory
|
||||
directory = self.dirs[r.name]
|
||||
inventory_path = os.path.join(directory, 'inventory')
|
||||
with open(inventory_path, 'w') as inv:
|
||||
|
5
x/resources/data_container/actions/echo.yml
Normal file
5
x/resources/data_container/actions/echo.yml
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
- hosts: [{{ ip }}]
|
||||
sudo: yes
|
||||
tasks:
|
||||
- shell: echo `/sbin/ifconfig`
|
Loading…
x
Reference in New Issue
Block a user