Permalink
Browse files

Added vagrant/ansible support (#640)

  • Loading branch information...
siad007 authored and mrook committed Mar 21, 2017
1 parent 1da6833 commit 9f86687306f0d101676f63e12d1f3090923b0c91
View
@@ -10,3 +10,6 @@ vendor
bin/*
!bin/pear*
!bin/phing*
+.vagrant
+**/*.log
+ansible/playbook.retry
View
@@ -0,0 +1,32 @@
+def which(cmd)
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
+ exts.each { |ext|
+ exe = File.join(path, "#{cmd}#{ext}")
+ return exe if File.executable? exe
+ }
+ end
+ return nil
+end
+
+Vagrant.configure(2) do |config|
+ config.vm.provider "virtualbox" do |v|
+ v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
+ end
+
+ config.vm.box = "mrlesmithjr/yakkety64"
+ config.vm.network 'private_network', ip: '192.168.255.2'
+ config.vm.host_name = "dev.phing.org"
+ config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", owner: "vagrant", group: "www-data"
+ config.vm.synced_folder '~/.composer', '/home/vagrant/.composer', id: "composer", owner: "vagrant", group: "www-data"
+ config.vm.provision :shell, inline: %q{echo "export VAGRANT_VERSION=2" >> /home/vagrant/.bashrc}
+
+ if which('ansible-playbook')
+ config.vm.provision "ansible" do |ansible|
+ ansible.playbook = "ansible/playbook.yml"
+ ansible.tags = "vagrant"
+ end
+ else
+ config.vm.provision 'shell', path: "ansible/windows.sh"
+ end
+end
View
@@ -0,0 +1,2 @@
+[dev.phing.org]
+192.168.255.2
View
@@ -0,0 +1,6 @@
+---
+- hosts: all
+ roles:
+ - { role: phing.vagrant, tags: [vagrant] }
+ - { role: phing.environment, tags: [vagrant] }
+ - { role: phing.php, tags: [vagrant] }
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+---
@@ -0,0 +1,14 @@
+---
+- name: Install required packages
+ apt: name={{item}} state=latest
+ with_items:
+ - curl
+ - git
+ - subversion
+ - mercurial
+ - python-pip
+ become: yes
+
+- name: install python-docutil
+ command: "pip install docutils"
+ become: yes
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+---
@@ -0,0 +1,34 @@
+---
+- name: Install PHP
+ apt: name=php state=latest
+ become: yes
+
+- name: Install PHP Modules
+ apt: name={{ item }} state=latest
+ with_items:
+ - php-bz2
+ - php-xdebug
+ - php-xsl
+ - php-zip
+ become: yes
+
+- name: Install sqlite extension
+ apt: pkg={{ item }} state=installed
+ become: yes
+ with_items:
+ - php7.0-sqlite3
+ - php7.0-mbstring
+ - sqlite3
+ - libsqlite3-dev
+
+- name: "Configure Phar extension."
+ become: yes
+ ini_file:
+ dest: /etc/php/7.0/cli/php.ini
+ section: Phar
+ option: phar.readonly
+ value: Off
+
+- name: Install composer
+ shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer creates=/usr/local/bin/composer
+ become: yes
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+---
@@ -0,0 +1,22 @@
+---
+- name: Set up the MOTD
+ template: dest=/etc/motd src=motd.j2 owner=root group=root mode=0644
+ become: yes
+
+- name: Adding existing user 'vagrant' to groups www-data,users
+ user: name=vagrant
+ groups=www-data,users
+ append=yes
+
+- name: Update our apt cache
+ apt: update_cache=yes
+ become: yes
+
+- name: Install Vim
+ apt: name={{ item }} state=latest
+ with_items:
+ - vim
+ become: yes
+
+- name: Have SSH user go to /vagrant by default
+ lineinfile: dest=/home/vagrant/.profile insertafter=EOF line="cd /vagrant"
@@ -0,0 +1 @@
+---
@@ -0,0 +1 @@
+Welcome to the Development Environment of phing.
@@ -0,0 +1 @@
+---
View
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+sudo apt-get update
+sudo apt-get install -y python-software-properties
+sudo add-apt-repository -y ppa:ansible/ansible
+sudo apt-get update
+sudo apt-get install -y ansible
+cp /vagrant/ansible/inventory /etc/ansible/hosts -f
+chmod 666 /etc/ansible/hosts
+sudo ansible-playbook /vagrant/ansible/playbook.yml --connection=local

1 comment on commit 9f86687

@kenguest

This comment has been minimized.

Show comment
Hide comment
@kenguest

kenguest Mar 21, 2017

Contributor

Nice, but is there any chance of using a 32-bit image for us poor souls that don't have beefy enough hardware to run 64-bit VMs? :)

Contributor

kenguest commented on 9f86687 Mar 21, 2017

Nice, but is there any chance of using a 32-bit image for us poor souls that don't have beefy enough hardware to run 64-bit VMs? :)

Please sign in to comment.