Skip to content

Commit 294ed8f

Browse files
committed
Initial skeleton
1 parent 42fff8d commit 294ed8f

File tree

14 files changed

+226
-0
lines changed

14 files changed

+226
-0
lines changed

.gitignore

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# OS generated files #
2+
######################
3+
.DS_Store
4+
.DS_Store?
5+
._*
6+
.Spotlight-V100
7+
.Trashes
8+
Icon?
9+
ehthumbs.db
10+
Thumbs.db
11+
12+
# IDE files #
13+
#################
14+
/.settings
15+
/.buildpath
16+
/.project
17+
/nbproject
18+
*.komodoproject
19+
*.kpf
20+
/.idea
21+
22+
# Vagrant files #
23+
.vagrant/
24+
vagrant_ansible_inventory_*
25+
ansible.cfg
26+
27+
# Other files #
28+
###############
29+
!empty

.travis.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
language: python
3+
python: "2.7"
4+
5+
env:
6+
- ANSIBLE_VERSION=1.4
7+
- ANSIBLE_VERSION=1.5
8+
- ANSIBLE_VERSION=1.6
9+
- ANSIBLE_VERSION=1.7
10+
- ANSIBLE_VERSION=1.8
11+
12+
before_install:
13+
- sudo apt-get update -qq
14+
15+
# Remove haproxy
16+
- sudo apt-get remove --purge haproxy
17+
18+
install:
19+
# Install Ansible.
20+
- pip install ansible==$ANSIBLE_VERSION
21+
22+
# Add ansible.cfg to pick up roles path.
23+
- printf "[defaults]\nroles_path = ../" > ansible.cfg
24+
25+
script:
26+
# Check the role/playbook's syntax.
27+
- ansible-playbook -i tests/inventory tests/test.yml --syntax-check
28+
29+
# Run the role/playbook with ansible-playbook.
30+
- ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo -vvvv
31+
32+
# Run the role/playbook again, checking to make sure it's idempotent.
33+
- >
34+
ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo
35+
| grep -q 'changed=0.*failed=0'
36+
&& (echo 'Idempotence test: pass' && exit 0)
37+
|| (echo 'Idempotence test: fail' && exit 1)
38+
39+
notifications:
40+
email: false

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## haproxy
2+
3+
[![Build Status](https://travis-ci.org/Oefenweb/ansible-haproxy.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-haproxy) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-haproxy-blue.svg)](https://galaxy.ansible.com/list#/roles/3856)
4+
5+
Set up the latest version of [HAProxy](http://www.haproxy.org/) in Ubuntu systems.
6+
7+
#### Requirements
8+
9+
* `python-apt`
10+
11+
#### Variables
12+
13+
* `haproxy_install`: [default: `[]`]: Additional packages to install
14+
15+
## Dependencies
16+
17+
None
18+
19+
#### Example
20+
21+
```yaml
22+
---
23+
- hosts: all
24+
roles:
25+
- haproxy
26+
```
27+
28+
#### License
29+
30+
MIT
31+
32+
#### Author Information
33+
34+
Mischa ter Smitten
35+
36+
#### Feedback, bug-reports, requests, ...
37+
38+
Are [welcome](https://github.com/Oefenweb/ansible-haproxy/issues)!

Vagrantfile

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby ts=2 sw=2 tw=0 et :
3+
4+
role = File.basename(File.expand_path(File.dirname(__FILE__)))
5+
6+
File.open(File.dirname(__FILE__) + '/ansible.cfg', 'w') { |f| f.write("[defaults]\nroles_path = ../") }
7+
8+
boxes = [
9+
{
10+
:name => "ubuntu-1004",
11+
:box => "opscode-ubuntu-10.04",
12+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-10.04_chef-provisionerless.box",
13+
:ip => '10.0.0.10',
14+
:cpu => "50",
15+
:ram => "256"
16+
},
17+
{
18+
:name => "ubuntu-1204",
19+
:box => "opscode-ubuntu-12.04",
20+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box",
21+
:ip => '10.0.0.11',
22+
:cpu => "50",
23+
:ram => "256"
24+
},
25+
{
26+
:name => "ubuntu-1404",
27+
:box => "opscode-ubuntu-14.04",
28+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box",
29+
:ip => '10.0.0.12',
30+
:cpu => "50",
31+
:ram => "256"
32+
},
33+
]
34+
35+
Vagrant.configure("2") do |config|
36+
boxes.each do |box|
37+
config.vm.define box[:name] do |vms|
38+
vms.vm.box = box[:box]
39+
vms.vm.box_url = box[:url]
40+
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"
41+
42+
vms.vm.provider "virtualbox" do |v|
43+
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
44+
v.customize ["modifyvm", :id, "--memory", box[:ram]]
45+
end
46+
47+
vms.vm.network :private_network, ip: box[:ip]
48+
49+
vms.vm.provision :ansible do |ansible|
50+
ansible.playbook = "tests/vagrant.yml"
51+
ansible.verbose = "vv"
52+
end
53+
end
54+
end
55+
end

defaults/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# defaults file for haproxy
2+
---
3+
haproxy_install: []

files/empty

Whitespace-only changes.

handlers/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# handlers file for haproxy
2+
---

meta/main.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# meta file for haproxy
2+
---
3+
galaxy_info:
4+
author: Mischa ter Smitten
5+
company: Oefenweb.nl B.V.
6+
description: Set up the latest version of HAProxy in Ubuntu systems
7+
license: MIT
8+
min_ansible_version: 1.4
9+
platforms:
10+
- name: Ubuntu
11+
versions:
12+
- lucid
13+
- precise
14+
- trusty
15+
categories:
16+
- system
17+
- web
18+
dependencies: []

tasks/main.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# tasks file for haproxy
2+
---
3+
- name: add repository from PPA and install its signing key
4+
apt_repository:
5+
repo: 'ppa:haproxy-team/ppa'
6+
update_cache: yes
7+
tags: [configuration, haproxy, haproxy-add-repository]
8+
9+
- name: install dependencies
10+
apt:
11+
name: "{{ item }}"
12+
state: latest
13+
with_items: haproxy_dependencies
14+
when: haproxy_dependencies
15+
tags: [configuration, haproxy, haproxy-dependencies]
16+
17+
- name: install
18+
apt:
19+
name: "{{ item }}"
20+
state: latest
21+
with_items: haproxy_install
22+
when: haproxy_install
23+
tags: [configuration, haproxy, haproxy-install]

templates/empty

Whitespace-only changes.

tests/inventory

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
localhost

tests/test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# test file for haproxy
2+
---
3+
- hosts: localhost
4+
remote_user: root
5+
roles:
6+
- ansible-haproxy

tests/vagrant.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# test file for haproxy
2+
---
3+
- hosts: all
4+
remote_user: vagrant
5+
sudo: true
6+
roles:
7+
- haproxy

vars/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# vars file for haproxy
2+
---
3+
haproxy_dependencies:
4+
- haproxy

0 commit comments

Comments
 (0)