Skip to content

Commit

Permalink
Merge pull request #15 from Oefenweb/update-haproxy-to-16
Browse files Browse the repository at this point in the history
Update haproxy to 1.6
  • Loading branch information
tersmitten committed Apr 15, 2016
2 parents 75687d2 + 2873ad7 commit ab2ac3d
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 22 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

[![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)

Set up the latest version of [HAProxy](http://www.haproxy.org/) in Ubuntu systems.
Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu systems.

#### Requirements

* `python-apt`

#### Variables

* `haproxy_version`: [default: `1.6`]: Version to install (e.g. `1.5`, `1.6`)

* `haproxy_install`: [default: `[]`]: Additional packages to install (e.g. `socat`)

* `haproxy_global_log`: [default: See `defaults/main.yml`]: Log declarations
Expand Down
8 changes: 0 additions & 8 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
role = File.basename(File.expand_path(File.dirname(__FILE__)))

boxes = [
{
:name => "ubuntu-1004",
:box => "opscode-ubuntu-10.04",
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-10.04_chef-provisionerless.box",
:ip => '10.0.0.10',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1204",
:box => "opscode-ubuntu-12.04",
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# defaults file for haproxy
---
haproxy_version: 1.6

haproxy_install: []

# global section
Expand Down
1 change: 0 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ galaxy_info:
platforms:
- name: Ubuntu
versions:
- lucid
- precise
- trusty
galaxy_tags:
Expand Down
54 changes: 43 additions & 11 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
# tasks file for haproxy
---
- name: check version support
fail:
msg: "HAProxy version {{ haproxy_version }} is not supported"
when: haproxy_version not in haproxy_versions_supported
tags:
- configuration
- haproxy
- haproxy-check-version-support

- name: add repository from PPA and install its signing key
apt_repository:
repo: "{{ haproxy_ppa }}"
update_cache: true
tags: [configuration, haproxy, haproxy-add-repository]
tags:
- configuration
- haproxy
- haproxy-add-repository

- name: install dependencies
apt:
name: "{{ item }}"
state: latest
with_items: haproxy_dependencies
tags: [configuration, haproxy, haproxy-dependencies]
with_items: "{{ haproxy_dependencies }}"
tags:
- configuration
- haproxy
- haproxy-dependencies

- name: install
apt:
name: "{{ item }}"
state: latest
with_items: haproxy_install
tags: [configuration, haproxy, haproxy-install]
with_items: "{{ haproxy_install }}"
tags:
- configuration
- haproxy
- haproxy-install

- name: create certificate files directories
file:
Expand All @@ -27,8 +45,12 @@
owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}"
mode: 0750
with_items: haproxy_ssl_map
tags: [configuration, haproxy, haproxy-configuration, haproxy-configuration-ssl]
with_items: "{{ haproxy_ssl_map }}"
tags:
- configuration
- haproxy
- haproxy-configuration
- haproxy-configuration-ssl

- name: copy certificate files
copy:
Expand All @@ -37,9 +59,13 @@
owner: "{{ item.owner | default('root') }}"
group: "{{ item.group | default('root') }}"
mode: "{{ item.mode | default('0640') }}"
with_items: haproxy_ssl_map
with_items: "{{ haproxy_ssl_map }}"
notify: restart haproxy
tags: [configuration, haproxy, haproxy-configuration, haproxy-configuration-ssl]
tags:
- configuration
- haproxy
- haproxy-configuration
- haproxy-configuration-ssl

- name: update configuration file
template:
Expand All @@ -50,11 +76,17 @@
mode: 0640
validate: 'haproxy -f %s -c'
notify: restart haproxy
tags: [configuration, haproxy, haproxy-configuration]
tags:
- configuration
- haproxy
- haproxy-configuration

- name: start and enable service
service:
name: haproxy
state: started
enabled: true
tags: [configuration, haproxy, haproxy-start-enable-service]
tags:
- configuration
- haproxy
- haproxy-start-enable-service
6 changes: 5 additions & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# vars file for haproxy
---
haproxy_ppa: 'ppa:vbernat/haproxy-1.5'
haproxy_versions_supported:
- 1.5
- 1.6

haproxy_ppa: "ppa:vbernat/haproxy-{{ haproxy_version }}"
haproxy_dependencies:
- haproxy

0 comments on commit ab2ac3d

Please sign in to comment.