Move bootstrap commands to ansible playbook

It will be easier to configure image outside of Vagrant env.

Change-Id: Icf0427a774afe5e6ee084e06219074a6e9d79abf
This commit is contained in:
Łukasz Oleś 2015-12-31 15:25:04 +01:00
parent de2ae20db3
commit b4975246f7
3 changed files with 17 additions and 5 deletions

5
Vagrantfile vendored
View File

@ -51,6 +51,7 @@ def ansible_playbook_command(filename, args=[])
end end
solar_script = ansible_playbook_command("solar.yaml") solar_script = ansible_playbook_command("solar.yaml")
solar_agent_script = ansible_playbook_command("solar-agent.yaml")
master_pxe = ansible_playbook_command("pxe.yaml") master_pxe = ansible_playbook_command("pxe.yaml")
@ -61,10 +62,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = MASTER_IMAGE config.vm.box = MASTER_IMAGE
config.vm.provision "shell", inline: solar_script, privileged: true config.vm.provision "shell", inline: solar_script, privileged: true
config.vm.provision "shell", inline: "cd /vagrant && docker-compose up -d" , privileged: true
config.vm.provision "shell", inline: master_pxe, privileged: true unless PREPROVISIONED config.vm.provision "shell", inline: master_pxe, privileged: true unless PREPROVISIONED
config.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "/vagrant/tmp/keys/ssh_private" config.vm.provision "file", source: "~/.vagrant.d/insecure_private_key", destination: "/vagrant/tmp/keys/ssh_private"
config.vm.provision "file", source: "bootstrap/ansible.cfg", destination: "/home/vagrant/.ansible.cfg"
config.vm.host_name = "solar-dev" config.vm.host_name = "solar-dev"
config.vm.provider :virtualbox do |v| config.vm.provider :virtualbox do |v|
@ -118,7 +117,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if PREPROVISIONED if PREPROVISIONED
config.vm.provision "file", source: "bootstrap/ansible.cfg", destination: "/home/vagrant/.ansible.cfg" config.vm.provision "file", source: "bootstrap/ansible.cfg", destination: "/home/vagrant/.ansible.cfg"
config.vm.provision "shell", inline: solar_script, privileged: true config.vm.provision "shell", inline: solar_agent_script, privileged: true
#TODO(bogdando) figure out how to configure multiple interfaces when was not PREPROVISIONED #TODO(bogdando) figure out how to configure multiple interfaces when was not PREPROVISIONED
ind = 0 ind = 0
SLAVES_IPS.each do |ip| SLAVES_IPS.each do |ip|

View File

@ -0,0 +1,10 @@
---
- hosts: all
sudo: yes
vars:
ssh_ip_mask: "10.0.0.*"
tasks:
# upgrade pbr first, old version throws strange errors
- shell: pip install pbr -U
- shell: pip install git+git://github.com/Mirantis/solar-agent.git

View File

@ -47,8 +47,11 @@
line: eval "$(_SOLAR_COMPLETE=source solar)" line: eval "$(_SOLAR_COMPLETE=source solar)"
state: present state: present
- hosts: all
tasks:
- file: path=/var/lib/solar/repositories state=directory - file: path=/var/lib/solar/repositories state=directory
- file: src=/vagrant/resources dest=/var/lib/solar/repositories/resources state=link - file: src=/vagrant/resources dest=/var/lib/solar/repositories/resources state=link
- file: src=/vagrant/templates dest=/var/lib/solar/repositories/templates state=link - file: src=/vagrant/templates dest=/var/lib/solar/repositories/templates state=link
- name: Starting docker containers
shell: docker-compose up -d chdir=/vagrant
- name: configuring Ansible
copy: src=/vagrant/bootstrap/ansible.cfg dest=/home/vagrant/.ansible.cfg