Add a VagrantFile for testing

This commit is contained in:
Victor LABORIE 2018-03-08 12:59:07 +01:00
parent 289b775304
commit 24cc53521f
4 changed files with 94 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.swp
config/config.ini
.vagrant

40
Vagrantfile vendored Normal file
View File

@ -0,0 +1,40 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
# Load ~/.VagrantFile if exist, permit local config provider
vagrantfile = File.join("#{Dir.home}", '.VagrantFile')
load File.expand_path(vagrantfile) if File.exists?(vagrantfile)
Vagrant.configure('2') do |config|
config.vm.synced_folder "./", "/vagrant", type: "rsync", rsync__exclude: [ '.vagrant', '.git', 'config/config.ini' ]
config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true
config.vm.network "forwarded_port", guest: 443, host: 8443, auto_correct: true
$deps = <<SCRIPT
DEBIAN_FRONTEND=noninteractive apt-get -yq install ansible git
ansible-galaxy install -r /vagrant/test/ansible/requirements.yml
echo "[defaults]" > '/vagrant/test/ansible/ansible.cfg'
echo "roles_path = /etc/ansible/roles/evolix" >> '/vagrant/test/ansible/ansible.cfg'
> /etc/hosts
SCRIPT
config.vm.define :packmail do |node|
node.vm.hostname = "evoadmin-mail"
node.vm.box = "debian/stretch64"
node.vm.provision "deps", type: "shell", :inline => $deps
node.vm.provision "ansible", type: "ansible_local" do |ansible|
ansible.provisioning_path = "/vagrant/test/ansible"
ansible.playbook = "evoadmin-mail.yml"
ansible.install_mode = ":default"
ansible.raw_arguments = [
"--become"
]
end
end
end

View File

@ -0,0 +1,48 @@
---
- hosts: all
gather_facts: yes
become: yes
vars:
evolinux_hostname: "evoadmin-mail"
evolinux_domain: "example.com"
evolinux_fqdn: "{{ evolinux_hostname }}.{{ evolinux_domain }}"
evomaintenance_alert_email: "evomaintenance-{{ evolinux_hostname }}@example.com"
roles:
- evolinux-base
- { role: postfix, postfix_packmail: True, postfix_force_main_cf: True }
- apache
- { role: php, php_apache_enable: True }
- { role: webapps/evoadmin-mail }
tasks:
- name: Disable redirection for evoadminmail vhost
lineinfile:
dest: /etc/apache2/sites-enabled/evoadminmail.conf
regexp: "Rewrite"
state: absent
- name: Fix rights on /etc/evolinux
file:
dest: /etc/evolinux
state: directory
mode: "0711"
- name: Link config.ini to evoadmin-mail.ini
file:
src: /etc/evolinux/evoadmin-mail.ini
dest: /vagrant/config/config.ini
state: link
- name: Remove distant htdocs dir
file:
dest: /home/evoadmin-mail/www
state: absent
- name: Use local htdocs dir
file:
src: /vagrant
dest: /home/evoadmin-mail/www
state: link
force: yes

View File

@ -0,0 +1,5 @@
---
- name: evolix
src: https://forge.evolix.org/ansible-roles.git
scm: git
version: evoadmin-mail