bifrost/tools/vagrant_dev_env/vagrant.yml
Dmitry Tantsur 4cb0395d75 Make virtual environment owned by root
It's dangerous to allow a regular user to write into the source code of
the services. The repositories are still writable, so that the
development workflow can still use the ``--develop`` flag to make
modifications.

While here, remove the horribly outdated and broken ANSIBLE_INSTALL_ROOT.

Change-Id: Id2e25dd57668d24a11dc2cd16eea2b607b7a3f16
2022-01-25 15:59:42 +01:00

100 lines
3.2 KiB
YAML

---
###############################################################################
#
#
- hosts: bifrost
become: yes
tasks:
############################################################################
# Install some reqired bits into the vm
############################################################################
- name: Remove private default route
command: ip route del default dev eth0
ignore_errors: true
#- name: trigger DHCP eth2
# command: dhclient eth2
# 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: Install pip
apt: name=python3-pip state=present
when: ansible_distribution == 'Ubuntu'
- name: Install python-dev
apt: name=python3-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 MySql-Server
apt: name=mariadb-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
#
# Systemd likes to do frustrating things with networking, so we need to
# wait a little bit.
- 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: make /root/.ssh folder
file:
path: /root/.ssh
state: directory
owner: root
group: root
mode: 0700
- 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: Prepare VM for Bifrost
command: scripts/env-setup.sh
environment:
LANG: c
VENV: "/opt/stack/bifrost"
args:
chdir: /home/vagrant/bifrost
become: yes
- name: Install Bifrost
command: ${VENV}/bin/ansible-playbook -vvvv -i inventory/target install.yaml -e network_interface={{network_interface}} -e ansible_python_interpreter="/usr/bin/python3" -e download_ipa=true -e use_cirros=true
environment:
PATH: "{{ansible_env.HOME}}/.local/bin:{{ansible_env.PATH}}"
VENV: "/opt/stack/bifrost"
args:
chdir: /home/vagrant/bifrost/playbooks