Created
August 27, 2015 19:38
-
-
Save grasmash/dd33fdab3620d0ee5c2a to your computer and use it in GitHub Desktop.
Phing-based VM tasks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project name="vm" default="build"> | |
<property name="vm.ansible.version" value="1.9.4" override="true" /> | |
<property name="vm.dir" value="${repo.root}/box" override="true" /> | |
<property name="vm.vbox.version" value="4.3" override="true" /> | |
<property name="vm.vagrant.version" value="1.7" override="true" /> | |
<target name="vm:add" description="Downloads and configures virtual machine" depends="vm:download, vm:configure, vm:bootstrap"> | |
</target> | |
<target name="vm:download" description="Downloads the virtual machine to /box."> | |
<httpget url="https://github.com/geerlingguy/drupal-vm/archive/${vm.ansible.version}.tar.gz" dir="${repo.root}" followRedirects="true" /> | |
<untar file="${repo.root}/${vm.version}.tar.gz" todir="${repo.root}" /> | |
<move file="${repo.root}/drupal-vm-${vm.ansible.version}" tofile="${vm.dir}" /> | |
<delete file="${repo.root}/${vm.ansible.version}.tar.gz" /> | |
</target> | |
<target name="vm:configure" description="Configures yaml for virtual machine."> | |
<copy file="${vm.dir}/example.config.yml" | |
tofile="${vm.dir}/config.yml"> | |
<!-- Expand placeholder properties in config.yml. --> | |
<filterchain> | |
<expandproperties /> | |
</filterchain> | |
</copy> | |
</target> | |
<target name="vm:bootstrap" description="Installs dependencies and bootstraps the virtual machine."> | |
<!-- Assert correct versions version. --> | |
<exec dir="${vm.dir}" command="! VBoxManage -v | grep '${vm.vbox.version}'" logoutput="true" passthru="true"/> | |
<exec dir="${vm.dir}" command="! vagrant -v | grep '${vm.vagrant.version}'" logoutput="true" passthru="true"/> | |
<exec dir="${vm.dir}" command="! ansible --version | grep '${vm.ansible.version}'" logoutput="true" passthru="true"/> | |
<!-- Install dependencies. --> | |
<exec dir="${vm.dir}" command="sudo ansible-galaxy install --force --role-file=${vm.dir}/provisioning/requirements.txt" logoutput="true" passthru="true"/> | |
<exec dir="${vm.dir}" command="vagrant plugin install vagrant-hostsupdater" logoutput="true" passthru="true"/> | |
<!-- Boot. --> | |
<exec dir="${vm.dir}" command="vagrant up" logoutput="true" passthru="true"/> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment