haproxy: use APT preferences to install haproxy from backports

This commit is contained in:
Jérémy Lecour 2017-05-10 14:32:50 +02:00 committed by Jérémy Lecour
parent 597ae12dca
commit fd5324db84
8 changed files with 43 additions and 9 deletions

View file

@ -0,0 +1,5 @@
# haproxy-backports-preferences
Configure APT to prefer haproxy package from jessie-backports.
There is no variable, just a files copied to `/etc/apt/preferences.d/`.

View file

@ -0,0 +1,3 @@
Package: haproxy
Pin: release a=jessie-backports
Pin-Priority: 999

View file

@ -0,0 +1,4 @@
---
- name: apt update
apt:
update_cache: yes

View file

@ -0,0 +1,19 @@
galaxy_info:
author: Evolix
description: Configure APT to prefer haproxy package from jessie-backports
issue_tracker_url: https://forge.evolix.org/projects/ansible-roles/issues
license: GPLv2
min_ansible_version: 2.2
platforms:
- name: Debian
versions:
- jessie
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View file

@ -0,0 +1,10 @@
---
- name: Prefer HAProxy package from jessie-backports
copy:
src: haproxy_preferences
dest: /etc/apt/preferences.d/999-haproxy
force: yes
mode: "0640"
notify: apt update
- meta: flush_handlers

View file

@ -8,10 +8,7 @@ Everything is in the `tasks/main.yml` file.
## Available variables
* `general_package_release`: which Debian release to use generally (default: `stable`).
* `haproxy_package_release`: which Debian release to use for HAProxy (default: `general_package_release`).
The full list of variables (with default values) can be found in `defaults/main.yml`.
There is no variable.
## Configuration templates

View file

@ -1,2 +0,0 @@
---
general_package_release: stable

View file

@ -8,9 +8,7 @@
- name: Install HAProxy package
apt:
name: haproxy
default_release: "{{ haproxy_package_release or general_package_release | mandatory }}"
update_cache: True
state: present
state: installed
- name: Copy HAProxy configuration
template: