ansible WIP

This commit is contained in:
Benoît Burnichon
2015-11-25 18:48:16 +01:00
parent e3f49db7b6
commit e8e996bb67
29 changed files with 485 additions and 240 deletions

326
Vagrantfile vendored
View File

@@ -1,250 +1,102 @@
require 'yaml'
Vagrant.require_version ">= 1.5"
unless Vagrant.has_plugin?("vagrant-hostsupdater")
raise 'vagrant-hostmanager is not installed! please run "vagrant plugin install vagrant-hostsupdater'
unless Vagrant.has_plugin?('vagrant-hostmanager')
raise "vagrant-hostmanager is not installed! Please run\n vagrant plugin install vagrant-hostmanager\n\n"
end
$root = File.dirname(File.expand_path(__FILE__))
# Check to determine whether we're on a windows or linux/os-x host,
# later on we use this to launch ansible in the supported way
# source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
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
root = File.dirname(File.expand_path(__FILE__))
def config_net(config)
# Configure hostmanager
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.hostmanager.aliases = [
$hostname + ".vb",
"www." + $hostname + ".vb",
"dev." + $hostname + ".vb"
]
#config.vm.network :public_network, type: "dhcp", bridge: "en0: Ethernet"
# Assign static IP if present in network config
if File.file?($root + "/.network.conf")
ipAddress = File.read($root + "/.network.conf")
config.vm.network :private_network, ip: ipAddress
else
# vboxnet0 can be changed to use a specific private_network
config.vm.network :private_network, type: "dhcp"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--hostonlyadapter2", "vboxnet0"]
end
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if vm.id
`VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/1/V4/IP"`.split()[1]
end
end
end
end
# By default, the name of the VM is the project's directory name
$hostname = File.basename($root)
Vagrant.configure("2") do |config|
Dir.glob(root+"/resources/vagrant/vms/**/puphpet/config.yaml").each do|f|
dir = File.dirname(File.expand_path(f+"/.."))
base_path = dir
configValues = YAML.load_file(f)
data = configValues['vagrantfile-local']
# Force vagrant folder in nfs mode. Windows users should comment following line
config.vm.synced_folder ".", "/vagrant", type: "nfs"
config.vm.define "vm-#{data['name']}" do |node|
node.vm.box = "#{data['vm']['box']}"
node.vm.box_url = "#{data['vm']['box_url']}"
if data['vm']['hostname'].to_s.strip.length != 0
node.vm.hostname = "#{data['vm']['hostname']}"
end
node.vm.provider :virtualbox do |vb|
vb.name = "#{data['name']}"
end
if data['vm']['network']['private_network'].to_s != ''
node.vm.network :private_network, ip: "#{data['vm']['network']['private_network']}"
end
data['vm']['network']['forwarded_port'].each do |i, port|
if port['guest'] != '' && port['host'] != ''
node.vm.network :forwarded_port, guest: port['guest'].to_i, host: port['host'].to_i
end
end
if Vagrant.has_plugin?('vagrant-hostsupdater')
hosts = Array.new()
if !configValues['apache']['install'].nil? &&
configValues['apache']['install'].to_i == 1 &&
configValues['apache']['vhosts'].is_a?(Hash)
configValues['apache']['vhosts'].each do |i, vhost|
hosts.push(vhost['servername'])
if vhost['serveraliases'].is_a?(Array)
vhost['serveraliases'].each do |vhost_alias|
hosts.push(vhost_alias)
end
end
end
elsif !configValues['nginx']['install'].nil? &&
configValues['nginx']['install'].to_i == 1 &&
configValues['nginx']['vhosts'].is_a?(Hash)
configValues['nginx']['vhosts'].each do |i, vhost|
hosts.push(vhost['server_name'])
if vhost['server_aliases'].is_a?(Array)
vhost['server_aliases'].each do |x, vhost_alias|
hosts.push(vhost_alias)
end
end
end
end
if hosts.any?
contents = File.open("#{dir}/puphpet/shell/hostsupdater-notice.txt", 'r'){ |file| file.read }
puts "\n\033[34m#{contents}\033[0m\n"
if node.vm.hostname.to_s.strip.length == 0
node.vm.hostname = 'puphpet-dev-machine'
end
node.hostsupdater.aliases = hosts
end
end
data['vm']['synced_folder'].each do |i, folder|
if folder['source'] == ''
folder['source'] = root
end
if folder['source'] != '' && folder['target'] != ''
if folder['sync_type'] == 'nfs'
node.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp', 'fsc']
elsif folder['sync_type'] == 'smb'
node.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}", type: "smb"
elsif folder['sync_type'] == 'rsync'
rsync_args = !folder['rsync']['args'].nil? ? folder['rsync']['args'] : ["--verbose", "--archive", "--delete", "-z"]
rsync_auto = !folder['rsync']['auto'].nil? ? folder['rsync']['auto'] : true
rsync_exclude = !folder['rsync']['exclude'].nil? ? folder['rsync']['exclude'] : [".vagrant/"]
node.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}",
rsync__args: rsync_args, rsync__exclude: rsync_exclude, rsync__auto: rsync_auto, type: "rsync"
else
node.vm.synced_folder "#{folder['source']}", "#{folder['target']}", id: "#{i}",
group: 'www-data', owner: 'www-data', mount_options: ["dmode=775", "fmode=764"]
end
end
end
node.vm.usable_port_range = (10200..10500)
if data['vm']['chosen_provider'].empty? || data['vm']['chosen_provider'] == "virtualbox"
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'
node.vm.provider :virtualbox do |virtualbox|
data['vm']['provider']['virtualbox']['modifyvm'].each do |key, value|
if key == "memory"
next
end
if key == "natdnshostresolver1"
value = value ? "on" : "off"
end
virtualbox.customize ["modifyvm", :id, "--#{key}", "#{value}"]
end
virtualbox.customize ["modifyvm", :id, "--memory", "#{data['vm']['memory']}"]
if data['vm']['hostname'].to_s.strip.length != 0
virtualbox.customize ["modifyvm", :id, "--name", node.vm.hostname]
end
end
end
if data['vm']['chosen_provider'] == "vmware_fusion" || data['vm']['chosen_provider'] == "vmware_workstation"
ENV['VAGRANT_DEFAULT_PROVIDER'] = (data['vm']['chosen_provider'] == "vmware_fusion") ? "vmware_fusion" : "vmware_workstation"
node.vm.provider "vmware_fusion" do |v|
data['vm']['provider']['vmware'].each do |key, value|
if key == "memsize"
next
end
v.vmx["#{key}"] = "#{value}"
end
v.vmx["memsize"] = "#{data['vm']['memory']}"
if data['vm']['hostname'].to_s.strip.length != 0
v.vmx["displayName"] = node.vm.hostname
end
end
end
if data['vm']['chosen_provider'] == "parallels"
ENV['VAGRANT_DEFAULT_PROVIDER'] = "parallels"
node.vm.provider "parallels" do |v|
data['vm']['provider']['parallels'].each do |key, value|
if key == "memsize"
next
end
v.customize ["set", :id, "--#{key}", "#{value}"]
end
v.memory = "#{data['vm']['memory']}"
v.cpus = "#{data['vm']['cpus']}"
if data['vm']['hostname'].to_s.strip.length != 0
v.name = node.vm.hostname
end
end
end
ssh_username = !data['ssh']['username'].nil? ? data['ssh']['username'] : "vagrant"
node.vm.provision "shell" do |s|
s.path = "#{base_path}/puphpet/shell/initial-setup.sh"
s.args = "/vagrant/resources/vagrant/vms/#{data['name']}/puphpet"
end
node.vm.provision "shell" do |kg|
kg.path = "#{base_path}/puphpet/shell/ssh-keygen.sh"
kg.args = "#{ssh_username}"
end
node.vm.provision :shell, :path => "#{base_path}/puphpet/shell/update-puppet.sh"
node.vm.provision :puppet do |puppet|
puppet.facter = {
"ssh_username" => "#{ssh_username}",
"provisioner_type" => ENV['VAGRANT_DEFAULT_PROVIDER'],
"vm_target_key" => 'vagrantfile-local',
}
puppet.manifests_path = "#{data['vm']['provision']['puppet']['manifests_path']}"
puppet.manifest_file = "#{data['vm']['provision']['puppet']['manifest_file']}"
puppet.module_path = "#{data['vm']['provision']['puppet']['module_path']}"
if !data['vm']['provision']['puppet']['options'].empty?
puppet.options = data['vm']['provision']['puppet']['options']
end
end
node.vm.provision :shell do |s|
s.path = "#{base_path}/puphpet/shell/execute-files.sh"
s.args = ["exec-once", "exec-always"]
end
node.vm.provision :shell, run: "always" do |s|
s.path = "#{base_path}/puphpet/shell/execute-files.sh"
s.args = ["startup-once", "startup-always"]
end
node.vm.provision :shell, :path => "#{base_path}/puphpet/shell/important-notices.sh"
if File.file?("#{dir}/puphpet/files/dot/ssh/id_rsa")
node.ssh.private_key_path = [
"#{dir}/puphpet/files/dot/ssh/id_rsa",
"#{dir}/puphpet/files/dot/ssh/insecure_private_key"
config.vm.provider :virtualbox do |v|
v.name = $hostname
v.customize [
"modifyvm", :id,
"--name", $hostname,
"--memory", 4096,
"--cpus", 2,
]
end
if !data['ssh']['host'].nil?
node.ssh.host = "#{data['ssh']['host']}"
end
if !data['ssh']['port'].nil?
node.ssh.port = "#{data['ssh']['port']}"
end
if !data['ssh']['username'].nil?
node.ssh.username = "#{data['ssh']['username']}"
end
if !data['ssh']['guest_port'].nil?
node.ssh.guest_port = data['ssh']['guest_port']
end
if !data['ssh']['shell'].nil?
node.ssh.shell = "#{data['ssh']['shell']}"
end
if !data['ssh']['keep_alive'].nil?
node.ssh.keep_alive = data['ssh']['keep_alive']
end
if !data['ssh']['forward_agent'].nil?
node.ssh.forward_agent = data['ssh']['forward_agent']
end
if !data['ssh']['forward_x11'].nil?
node.ssh.forward_x11 = data['ssh']['forward_x11']
end
if !data['vagrant']['host'].nil?
node.vagrant.host = data['vagrant']['host'].gsub(":", "").intern
config.vm.box = "ubuntu/trusty64"
config.ssh.forward_agent = true
config_net(config)
# If ansible is in your path it will provision from your HOST machine
# If ansible is not found in the path it will be instaled in the VM and provisioned from there
if which('ansible-playbook')
config.vm.provision "ansible" do |ansible|
ansible.playbook = "resources/ansible/playbook.yml"
#ansible.inventory_path = "ansible/inventories/dev"
ansible.limit = 'all'
ansible.extra_vars = {
hostname: $hostname,
postfix: {
postfix_domain: $hostname + ".vb"
}
}
end
config.vm.provision "ansible", run: "always" do |ansible|
ansible.playbook = "resources/ansible/playbook-always.yml"
ansible.limit = 'all'
ansible.extra_vars = {
hostname: $hostname
}
end
else
config.vm.provision :shell, path: "resources/ansible/windows.sh", args: ["default"]
config.vm.provision :shell, run: "always", path: "resources/ansible/windows-always.sh", args: ["default"]
end
config.vm.synced_folder "./", "/vagrant", type: "nfs"
end

View File

@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

View File

@@ -0,0 +1,2 @@
[phansible-web]
192.168.56.101

View File

@@ -0,0 +1,7 @@
---
- hosts: all
sudo: true
vars_files:
- vars/all.yml
roles:
- app_reset

View File

@@ -0,0 +1,15 @@
---
- hosts: all
sudo: true
vars_files:
- vars/all.yml
roles:
- server
- vagrant_local
- nginx
- mariadb
- elasticsearch
- php
- xdebug
- composer
- app

View File

@@ -0,0 +1,2 @@
---
# application tasks to be customized and to run after the main provision

View File

@@ -0,0 +1 @@
---

View File

@@ -0,0 +1,2 @@
- name: Install Composer
shell: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer creates=/usr/local/bin/composer

View File

@@ -0,0 +1,2 @@
---
elasticsearch_url: https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-{{ elasticsearch.version }}.deb

View File

@@ -0,0 +1,47 @@
---
- name: Check Elastic Search installation
shell: apt-cache policy elasticsearch | grep -Po 'Installed:\s(.*)' | cut -d' ' -f 2;
changed_when: false
register: install_status
- name: Set installed variable
set_fact: is_installed='{{ install_status.stdout == elasticsearch.version }}'
- name: Add dependencies repository
apt_repository: repo='ppa:webupd8team/java' update_cache=yes
- name: Set dependencies License
shell: echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
changed_when: false
- name: Install Dependencies
apt: pkg=oracle-java8-installer state=latest
- name: Download
get_url: >
url={{ elasticsearch_url }}
dest=/tmp/elasticsearch-{{ elasticsearch.version }}.deb
when: not is_installed
- name: Install
apt: deb=/tmp/elasticsearch-{{ elasticsearch.version }}.deb
when: not is_installed
- name: Set port
replace: >
dest="/etc/elasticsearch/elasticsearch.yml"
regexp='^#?(http\.port\:).*'
replace='\1 {{ elasticsearch.port }}'
- name: Flush handlers to apply config changes
meta: flush_handlers
- name: Enable Service
service: name=elasticsearch enabled=yes
- name: Ensure Elastic Search is started
service: name=elasticsearch state=started
- name: Remove tmp files
file: path=/tmp/elasticsearch-{{ elasticsearch.version }}.deb state=absent
when: not is_installed

View File

@@ -0,0 +1,47 @@
---
# Retrieve the current hostname, because {{ ansible_hostname }} still contains the old name
- shell: hostname
register: current_hostname
- name: Add MariaDB-Repository
sudo: yes
apt_repository: repo='deb http://mirror3.layerjet.com/mariadb/repo/10.1/ubuntu {{ ansible_distribution_release }} main' state=present
- name: Add Key for MariaDB Repository
sudo: yes
apt_key: url=http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xcbcb082a1bb943db
- name: Update apt
sudo: yes
apt: update_cache=yes
- name: mariadb | Install MariaDB Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- mariadb-server
- python-mysqldb
- name: mariadb | Update root password for all root accounts
mysql_user: name=root host={{ item }} check_implicit_admin=yes password={{ mariadb.root_password }} login_user=root login_password={{ mariadb.root_password }}
with_items:
- "{{ current_hostname.stdout | lower }}"
- 127.0.0.1
- ::1
- localhost
- name: mariadb | Ensure anonymous users are not in the database
mysql_user: name='' host={{ item }} state=absent login_user=root login_password={{ mariadb.root_password }}
with_items:
- localhost
- "{{ current_hostname.stdout | lower }}"
- name: mariadb | Create databases
mysql_db: name={{ mariadb.database }} state=present login_user=root login_password={{ mariadb.root_password }}
- name: mariadb | Import dump
mysql_db: name={{ mariadb.database }} state=import login_user=root login_password={{ mariadb.root_password }} target=/vagrant/{{ mariadb.dump }}
when: mariadb.dump
- name: mariadb | Create users
mysql_user: name={{ mariadb.user }} password={{ mariadb.password }} priv={{ mariadb.database }}.*:ALL state=present login_user=root login_password={{ mariadb.root_password }}

View File

@@ -0,0 +1,3 @@
---
- name: restart nginx
service: name=nginx enabled=yes state=restarted

View File

@@ -0,0 +1,9 @@
---
- name: Install Nginx
sudo: yes
apt: pkg=nginx state=latest
- name: Change default nginx site
sudo: yes
template: src=default.tpl dest=/etc/nginx/sites-available/default
notify: restart nginx

View File

@@ -0,0 +1,27 @@
server {
listen 80;
root {{ nginx.docroot }};
index index.html index.php;
server_name {{ nginx.servername }};
location / {
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

View File

@@ -0,0 +1,3 @@
---
- name: restart php5-fpm
service: name=php5-fpm enabled=yes state=restarted

View File

@@ -0,0 +1,19 @@
---
- stat: path=/etc/php5/apache2/php.ini
register: modphp
- stat: path=/etc/php5/fpm/php.ini
register: phpfpm
- stat: path=/etc/php5/cli/php.ini
register: phpcli
- include: php-fpm.yml
when: phpfpm.stat.exists
- include: php-cli.yml
when: phpcli.stat.exists
- include: mod-php.yml
when: modphp.stat.exists

View File

@@ -0,0 +1,21 @@
---
- name: Add ppa Repository
sudo: yes
apt_repository: repo=ppa:ondrej/{{ php.ppa }} update_cache=yes
- name: Install php5
sudo: yes
apt: pkg=php5 state=latest
- name: Install php5-fpm
sudo: yes
apt: pkg=php5-fpm state=latest
- name: Install PHP Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items: php.packages
when: php.packages is defined
- include: configure.yml
- include: pecl.yml

View File

@@ -0,0 +1,10 @@
---
- name: ensure timezone is set in apache2 php.ini
lineinfile: dest=/etc/php5/apache2/php.ini
regexp='date.timezone ='
line='date.timezone = {{ server.timezone }}'
- name: enabling opcache
lineinfile: dest=/etc/php5/apache2/php.ini
regexp=';?opcache.enable=\d'
line='opcache.enable=1'

View File

@@ -0,0 +1,26 @@
- name: Install
apt: pkg="php5-dev" state=present
when: php.pecl_packages is defined
- name: Install Package
shell: echo "\n\n\n\n\n\n\n\n\n" | pecl install {{ item.package }}
register: pecl_result
changed_when: "'already installed' not in pecl_result.stdout"
failed_when: "pecl_result.stderr or ('ERROR' in pecl_result.stdout)"
with_items: php.pecl_packages
when: php.pecl_packages is defined
- name: Create extension .ini file
template: >
src="extension.tpl"
dest="/etc/php5/mods-available/{{ item.name }}.ini"
owner="root"
group="root"
mode=0644
with_items: php.pecl_packages
when: php.pecl_packages is defined
- name: Enable extension
shell: php5enmod {{ item.name }}
with_items: php.pecl_packages
when: php.pecl_packages is defined

View File

@@ -0,0 +1,10 @@
---
- name: ensure timezone is set in cli php.ini
lineinfile: dest=/etc/php5/cli/php.ini
regexp='date.timezone ='
line='date.timezone = {{ server.timezone }}'
- name: enabling opcache cli
lineinfile: dest=/etc/php5/cli/php.ini
regexp=';?opcache.enable_cli=\d'
line='opcache.enable_cli=1'

View File

@@ -0,0 +1,19 @@
---
- name: Set permissions on socket - owner
lineinfile: "dest=/etc/php5/fpm/pool.d/www.conf state=present regexp='^;?listen.owner' line='listen.owner = www-data'"
- name: Set permissions on socket - group
lineinfile: "dest=/etc/php5/fpm/pool.d/www.conf state=present regexp='^;?listen.group' line='listen.group = www-data'"
- name: Set permissions on socket - mode
lineinfile: "dest=/etc/php5/fpm/pool.d/www.conf state=present regexp='^;?listen.mode' line='listen.mode = 0660'"
notify: restart php5-fpm
- name: ensure timezone is set in fpm php.ini
lineinfile: dest=/etc/php5/fpm/php.ini
regexp='date.timezone ='
line='date.timezone = {{ server.timezone }}'
- name: enabling opcache
lineinfile: dest=/etc/php5/fpm/php.ini
regexp=';?opcache.enable=\d'
line='opcache.enable=1'

View File

@@ -0,0 +1,2 @@
; Configuration for php PECL {{ item }} extension
extension={{ item }}.so

View File

@@ -0,0 +1,31 @@
---
- name: Update apt
sudo: yes
apt: update_cache=yes
- name: Install System Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- curl
- wget
- python-software-properties
- name: Install Extra Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items: server.packages
when: server.packages is defined
- name: Configure the timezone
sudo: yes
template: src=timezone.tpl dest=/etc/timezone
- name: More Configure the timezone
sudo: yes
file: src=/usr/share/zoneinfo/{{server.timezone}} dest=/etc/localtime state=link force=yes backup=yes
- name: Set default system language pack
shell: locale-gen {{server.locale}}
sudo: yes

View File

@@ -0,0 +1 @@
{{server.timezone}}

View File

@@ -0,0 +1,11 @@
---
- name: Set the hostname in /etc/hostname
shell: echo {{ vagrant_local.vm.hostname }} > /etc/hostname
when: vagrant_local.vm.hostname is defined
- name: Set the hostname
shell: hostname {{ vagrant_local.vm.hostname }}
when: vagrant_local.vm.hostname is defined
- name: Update /etc/hosts
lineinfile: dest=/etc/hosts regexp='^127\.0\.0\.1' line='127.0.0.1 localhost {{ vagrant_local.vm.hostname }}' owner=root group=root mode=0644

View File

@@ -0,0 +1,5 @@
---
xdebug:
settings:
remote_enable: On
remote_connect_back: On

View File

@@ -0,0 +1,4 @@
---
- name: Install xDebug
sudo: yes
apt: pkg=php5-xdebug state=latest

View File

@@ -0,0 +1,35 @@
---
server:
install: '1'
packages: [vim, git, imagemagick, htop, nodejs, npm, iotop, pkg-config, libzmq3-dev]
timezone: UTC
locale: fr_FR.UTF-8
vagrant_local:
install: '1'
vm: { base_box: trusty64, hostname: phraseanet.dev, ip: 192.168.56.101, memory: '4096', sharedfolder: ./, useVagrantCloud: '1', syncType: nfs }
nginx:
install: '1'
docroot: /vagrant
servername: master.phraseanet.vb
mariadb:
install: '1'
root_password: toor
database: ab_master
user: phraseanet
password: phraseanet
dump: ''
elasticsearch:
install: '1'
port: '9200'
version: 1.5.2
php:
install: '1'
ppa: php5
packages: [php5-cli, php5-intl, php5-mcrypt, php5-enchant, php5-gd, php5-imagick, php5-memcache, php5-memcached, php5-curl, php5-mysql, php5-sqlite]
pecl_packages:
- {name: zmq, package: zmq-beta}
xdebug:
install: '1'
composer:
install: '1'

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# Update Repositories
sudo apt-get update
# Determine Ubuntu Version
. /etc/lsb-release
# Decide on package to install for `add-apt-repository` command
#
# USE_COMMON=1 when using a distribution over 12.04
# USE_COMMON=0 when using a distribution at 12.04 or older
USE_COMMON=$(echo "$DISTRIB_RELEASE > 12.04" | bc)
if [ "$USE_COMMON" -eq "1" ];
then
sudo apt-get install -y software-properties-common
else
sudo apt-get install -y python-software-properties
fi
# Add Ansible Repository & Install Ansible
sudo add-apt-repository -y ppa:ansible/ansible
sudo apt-get update
sudo apt-get install -y ansible
# Setup Ansible for Local Use and Run
cp /vagrant/ansible/inventories/dev /etc/ansible/hosts -f
chmod 666 /etc/ansible/hosts
cat /vagrant/ansible/files/authorized_keys >> /home/vagrant/.ssh/authorized_keys
sudo ansible-playbook /vagrant/ansible/playbook.yml -e hostname=$1 --connection=local