From 5427f4e5870f6f0df5fd63bbe49ddd485b5bde53 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 12 Dec 2015 17:38:32 +0200
Subject: [PATCH] - Updated the README and TODO list. - Implemented backports
 archive support for Debian and Ubuntu.

---
 README.rst             | 7 +++----
 tasks/backports.yml    | 1 -
 tasks/main.yml         | 2 +-
 templates/backports.j2 | 4 +++-
 vars/main.yml          | 2 ++
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/README.rst b/README.rst
index a16936f..8315d88 100644
--- a/README.rst
+++ b/README.rst
@@ -2,8 +2,8 @@ Ansible-common
 ##############
 
 An Ansible role with common tasks that ran on all (or most) hosts.
-The tls_key_path and tls_cert_path facts are added to point to the path of the
-host's key and cert.
+The tls_key_path, tls_cert_path and tls_ca_cert_path facts are added to point to
+the path of the host's key and cert.
 
 Requirements
 ------------
@@ -84,9 +84,8 @@ TODO
 
 - Implement:
   - add_tls_cert (Debian works, OpenBSD has no mechannism).
-  - debian_backports (add Ubuntu, priority support).
   - collectd_agent.
-  - init.
+  - init (via module).
   - ldap_login (with pam_mkhomedir).
   - ntp.
   - mail_forward (OpenBSD support?).
diff --git a/tasks/backports.yml b/tasks/backports.yml
index 425a69b..b3fd357 100644
--- a/tasks/backports.yml
+++ b/tasks/backports.yml
@@ -14,7 +14,6 @@
     update_cache: yes
 
 - name: Add repo priority pinning
-  when: backports_priority is defined
   template:
     src: backports.j2
     dest: /etc/apt/preferences.d/backports
diff --git a/tasks/main.yml b/tasks/main.yml
index 68e3982..8d31a1f 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -9,7 +9,7 @@
   when: ansible_os_family == 'Debian' and not common_role_finished is defined
 
 - include: backports.yml
-  when: backports|default(False) and ansible_distribution == 'Debian'and common_role_finished is defined
+  when: backports|default(False) and ansible_os_family == 'Debian' and not common_role_finished is defined
 
 - include: add_repo.yml
   when: ansible_distribution == 'Debian' and extra_repos is defined and not common_role_finished is defined
diff --git a/templates/backports.j2 b/templates/backports.j2
index 880cff4..8519453 100644
--- a/templates/backports.j2
+++ b/templates/backports.j2
@@ -1 +1,3 @@
-{# assume backports_priority is defined #}
+Package: *
+Pin: release a={{ ansible_distribution_release }}-backports
+Pin-Priority: 500
diff --git a/vars/main.yml b/vars/main.yml
index c1824e9..466d352 100644
--- a/vars/main.yml
+++ b/vars/main.yml
@@ -12,6 +12,8 @@ backports_repo:
   squeeze: http://httpredir.debian.org/debian-backports squeeze-backports main
   wheezy: http://httpredir.debian.org/debian wheezy-backports main
   jessie: http://httpredir.debian.org/debian jessie-backports main
+  precise: http://archive.ubuntu.com/ubuntu precise-backports main universe multiverse
+  trusty: http://archive.ubuntu.com/ubuntu trusty-backports main universe multiverse
 
 debian_init:
   'systemd-sysv': systemd
-- 
GitLab