mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
Add a vagrant setup with ansible
This commit is contained in:
parent
5f5b34db27
commit
7ebcb6725c
14
Vagrantfile
vendored
14
Vagrantfile
vendored
@ -4,11 +4,23 @@
|
|||||||
VAGRANTFILE_API_VERSION = "2"
|
VAGRANTFILE_API_VERSION = "2"
|
||||||
|
|
||||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
config.vm.box = "hashicorp/precise32"
|
config.vm.box = "ubuntu/trusty64"
|
||||||
config.vm.network :forwarded_port, guest: 3000, host: 3000
|
config.vm.network :forwarded_port, guest: 3000, host: 3000
|
||||||
|
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
# vb.gui = true
|
# vb.gui = true
|
||||||
vb.customize ["modifyvm", :id, "--memory", "512"]
|
vb.customize ["modifyvm", :id, "--memory", "512"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.vm.provider :lxc do |lxc, override|
|
||||||
|
override.vm.box = "trusty64-lxc"
|
||||||
|
override.vm.box_url = "https://vagrantcloud.com/fgrehm/boxes/trusty64-lxc/versions/2/providers/lxc.box"
|
||||||
|
lxc.backingstore = "btrfs"
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.provision :ansible do |ansible|
|
||||||
|
ansible.playbook = "playbooks/playbook.yml"
|
||||||
|
ansible.sudo = true
|
||||||
|
ansible.extra_vars = { ansible_ssh_user: 'vagrant' }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
45
playbooks/playbook.yml
Normal file
45
playbooks/playbook.yml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
gather_facts: true
|
||||||
|
vars:
|
||||||
|
username: semaphore
|
||||||
|
homedir: /opt/semaphore
|
||||||
|
logdir: /var/log/semaphore
|
||||||
|
sudo: true
|
||||||
|
tasks:
|
||||||
|
- user: name={{ username }}
|
||||||
|
- apt_repository: repo='ppa:ansible/ansible'
|
||||||
|
|
||||||
|
- name: install required packages
|
||||||
|
apt: name={{ item }} state=present update_cache=yes
|
||||||
|
with_items:
|
||||||
|
- git
|
||||||
|
- nodejs
|
||||||
|
- npm
|
||||||
|
- mongodb-server
|
||||||
|
- redis-server
|
||||||
|
- ansible
|
||||||
|
- runit
|
||||||
|
- npm: name={{ item }} global=yes
|
||||||
|
with_items:
|
||||||
|
- grunt-cli
|
||||||
|
- bower
|
||||||
|
- git: repo=https://github.com/tjheeta/semaphore dest={{ homedir }}
|
||||||
|
- file: src=/usr/bin/nodejs dest=/usr/bin/node state=link
|
||||||
|
- shell: bower install --allow-root && npm install > {{ homedir }}/somelog.txt
|
||||||
|
args:
|
||||||
|
chdir: "{{ homedir }}"
|
||||||
|
creates: "{{ homedir }}/somelog.txt"
|
||||||
|
- shell: chown -R {{ username }} {{ homedir }}
|
||||||
|
|
||||||
|
# copy over the example credentials
|
||||||
|
- shell: cp -p {{ homedir }}/lib/credentials.example.json {{ homedir }}/lib/credentials.json
|
||||||
|
|
||||||
|
# Setup runit and logging to /var/log/runit_semaphore
|
||||||
|
- file: path={{ homedir }}/runit_semaphore/log state=directory
|
||||||
|
- file: path={{ logdir }} state=directory owner={{ username }}
|
||||||
|
- copy: src=run_semaphore dest={{ homedir }}/runit_semaphore/run mode=0755
|
||||||
|
- template: src=run_semaphore_log.j2 dest={{ homedir }}/runit_semaphore/log/run mode=0755
|
||||||
|
- file: src={{ homedir }}/runit_semaphore dest=/etc/service/runit_semaphore state=link
|
||||||
|
|
||||||
|
|
4
playbooks/run_semaphore
Normal file
4
playbooks/run_semaphore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd /opt/semaphore/
|
||||||
|
exec grunt serve
|
2
playbooks/run_semaphore_log.j2
Normal file
2
playbooks/run_semaphore_log.j2
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
exec chpst -u {{ username }} svlogd -tt {{ logdir }}
|
Loading…
Reference in New Issue
Block a user