Skip to content

Commit

Permalink
feat: create a VM with ubuntu distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien Arcellier committed Nov 13, 2016
0 parents commit d270eeb
Show file tree
Hide file tree
Showing 14 changed files with 121 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
.vagrant
**.retry
30 changes: 30 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"

config.vm.network "forwarded_port", guest: 9200, host: 9200

config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end

config.vm.provision "shell", inline: <<-SCRIPT
mkdir /home/vagrant/ansible-local
cp -rf /vagrant/* /home/vagrant/ansible-local
chmod -x /home/vagrant/ansible-local/inventory.ini
apt-get update
apt-get install -y python-pip
apt-get install -y python-dev
apt-get install -y libffi-dev
apt-get install -y libssl-dev
pip install markupsafe
pip install ansible
export PYTHONUNBUFFERED=1
ansible-playbook -i "/home/vagrant/ansible-local/local.ini" "/home/vagrant/ansible-local/site.yml"
SCRIPT
end
3 changes: 3 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
host_key_checking = False
roles_path = playbooks/roles
4 changes: 4 additions & 0 deletions local.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
localhost ansible_connection=local

[elasticsearch]
localhost
10 changes: 10 additions & 0 deletions playbooks/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- hosts: elasticsearch
become: yes
become_method: sudo
vars:

tasks:

roles:
- fabientools.elasticsearch
29 changes: 29 additions & 0 deletions playbooks/roles/fabientools.elasticsearch/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "2.7"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
2 changes: 2 additions & 0 deletions playbooks/roles/fabientools.elasticsearch/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for fabientools.elasticsearch
2 changes: 2 additions & 0 deletions playbooks/roles/fabientools.elasticsearch/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# handlers file for fabientools.elasticsearch
16 changes: 16 additions & 0 deletions playbooks/roles/fabientools.elasticsearch/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
galaxy_info:
author: fabien arcellier
description: setup elasticsearch instance that listen on 0.0.0.0:9200
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2


platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial

galaxy_tags: []
dependencies: []
2 changes: 2 additions & 0 deletions playbooks/roles/fabientools.elasticsearch/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# tasks file for fabientools.elasticsearch
1 change: 1 addition & 0 deletions playbooks/roles/fabientools.elasticsearch/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost
5 changes: 5 additions & 0 deletions playbooks/roles/fabientools.elasticsearch/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- fabientools.elasticsearch
2 changes: 2 additions & 0 deletions site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
- include: playbooks/elasticsearch.yml

0 comments on commit d270eeb

Please sign in to comment.