From b4975246f719eacf891d2d8ce622aab7fb6b5185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Ole=C5=9B?= Date: Thu, 31 Dec 2015 15:25:04 +0100 Subject: [PATCH] Move bootstrap commands to ansible playbook It will be easier to configure image outside of Vagrant env. Change-Id: Icf0427a774afe5e6ee084e06219074a6e9d79abf --- Vagrantfile | 5 ++--- bootstrap/playbooks/solar-agent.yaml | 10 ++++++++++ bootstrap/playbooks/solar.yaml | 7 +++++-- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 bootstrap/playbooks/solar-agent.yaml diff --git a/Vagrantfile b/Vagrantfile index b47088ff..9db8bce8 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -51,6 +51,7 @@ def ansible_playbook_command(filename, args=[]) end solar_script = ansible_playbook_command("solar.yaml") +solar_agent_script = ansible_playbook_command("solar-agent.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.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 "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.provider :virtualbox do |v| @@ -118,7 +117,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| if PREPROVISIONED 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 ind = 0 SLAVES_IPS.each do |ip| diff --git a/bootstrap/playbooks/solar-agent.yaml b/bootstrap/playbooks/solar-agent.yaml new file mode 100644 index 00000000..66f484e4 --- /dev/null +++ b/bootstrap/playbooks/solar-agent.yaml @@ -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 diff --git a/bootstrap/playbooks/solar.yaml b/bootstrap/playbooks/solar.yaml index b93e6e9a..714df06b 100644 --- a/bootstrap/playbooks/solar.yaml +++ b/bootstrap/playbooks/solar.yaml @@ -47,8 +47,11 @@ line: eval "$(_SOLAR_COMPLETE=source solar)" state: present -- hosts: all - tasks: - file: path=/var/lib/solar/repositories state=directory - file: src=/vagrant/resources dest=/var/lib/solar/repositories/resources 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