bifrost/tools/vagrant_dev_env/vagrant.yml
Ganesh Maharaj Mahalingam e7fc06aadc Make ansible installation directory configurable
This change helps with the remote problem where ansible is installed
on a machine using the same script by User A and User B is also
trying to use ansible using the same method. The change lets each
user have his own copy of ansible installed in a directory of
his/her choosing.

Change-Id: I8fddaaa8cad291da840ac44c4b1e9a7a93f92aee
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
Partial-Bug: #1589672
2016-06-06 13:24:46 -07:00

88 lines
2.9 KiB
YAML

---
###############################################################################
#
#
- hosts: bifrost
become: yes
tasks:
############################################################################
# Install some reqired bits into the vm
############################################################################
# Make sure our VM's software is ~@Latest
- name: Apt Update
apt: update_cache=yes
upgrade=dist
cache_valid_time=86400
when: ansible_distribution == 'Ubuntu'
- name: Make sure distro setuptools is not there
apt: name=python-setuptools state=absent
when: ansible_distribution == 'Ubuntu'
- name: Download get-pip
get_url: url=https://bootstrap.pypa.io/get-pip.py
dest=/tmp/get-pip.py
- name: Install pip
shell: python /tmp/get-pip.py
- name: Install python-dev
apt: name=python-dev state=present
when: ansible_distribution == 'Ubuntu'
# these would also be installed by 'Prepare VM for Bifrost'
# below As they are larger packages I think its worth installing
# them on their own.
- name: Install erlang-base
apt: name=erlang-base state=present
when: ansible_distribution == 'Ubuntu'
- name: Install Rabbit-Server
apt: name=rabbitmq-server state=present
when: ansible_distribution == 'Ubuntu'
- name: Install MySql-Server
apt: name=mysql-server state=present
when: ansible_distribution == 'Ubuntu'
# get ip for public_network
- name: Get ip
shell: ip addr show eth2 | grep inet | grep -v inet6 | awk '{print $2}' | cut -d/ -f1
register: guest_ip
# Reboot if required.
- name: Reboot system if required
command: shutdown -r now 'Rebooting to complete system upgrade'
removes=/var/run/reboot-required
register: rebooted
- name: Wait for VM Reboot.
become: no
local_action: wait_for
port=22
host="{{guest_ip.stdout}}"
search_regex=OpenSSH
delay=10
timeout=900
when: rebooted.changed
- name: Copy SSH public key into VM
copy: src=~/.ssh/{{public_key}} dest=~/.ssh/id_rsa.pub
- name: Ensure /opt/stack folder exists
file: path=/opt/stack state=directory owner=vagrant
- name: Ensure ansible root folder exists
file: path={{ansible_install_root}} state=directory owner=vagrant
- name: Prepare VM for Bifrost
command: /home/vagrant/bifrost/scripts/env-setup.sh
environment:
ANSIBLE_INSTALL_ROOT: "{{ansible_install_root}}"
- name: Install Bifrost
shell: source {{ansible_install_root}}/ansible/hacking/env-setup && ansible-playbook -vvvv -i inventory/localhost install.yaml -e network_interface={{network_interface}}
args:
chdir: /home/vagrant/bifrost/playbooks
executable: /bin/bash