break out settings for stable and testing

Wed, 13 Apr 2016 12:34:38 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 13 Apr 2016 12:34:38 -0400
changeset 32
70eb0f5478d8
parent 31
9773f51c2d57
child 33
55dd06908d87

break out settings for stable and testing

roles/repositories/files/preferences.d/10-testing file | annotate | diff | comparison | revisions
roles/repositories/files/preferences.d/20-unstable file | annotate | diff | comparison | revisions
roles/repositories/tasks/debian-stable.yml file | annotate | diff | comparison | revisions
roles/repositories/tasks/debian-testing.yml file | annotate | diff | comparison | revisions
roles/repositories/tasks/debian.yml file | annotate | diff | comparison | revisions
roles/repositories/tasks/main.yml file | annotate | diff | comparison | revisions
new file mode 100644
--- /dev/null
+++ b/roles/repositories/files/preferences.d/10-testing
@@ -0,0 +1,3 @@
+Package: *
+Pin: release a=testing
+Pin-Priority: 900
new file mode 100644
--- /dev/null
+++ b/roles/repositories/files/preferences.d/20-unstable
@@ -0,0 +1,3 @@
+Package: *
+Pin: release a=unstable
+Pin-Priority: -1
new file mode 100644
--- /dev/null
+++ b/roles/repositories/tasks/debian-stable.yml
@@ -0,0 +1,9 @@
+---
+- name: add backports repo
+  apt_repository:
+    repo: "deb http://http.debian.net/debian {{ansible_distribution_release}}-backports main"
+
+- name: add pgdg repo
+  apt_repository:
+    repo: "deb http://apt.postgresql.org/pub/repos/apt/ {{ansible_distribution_release}}-pgdg main"
+  when: ansible_architecture in ["i386", "x86_64"]
new file mode 100644
--- /dev/null
+++ b/roles/repositories/tasks/debian-testing.yml
@@ -0,0 +1,12 @@
+---
+- name: set up repo preferences
+  copy:
+    src: 'preferences.d/{{item}}'
+    dest: /etc/apt/preferences.d/
+  with_items:
+    - '10-testing'
+    - '20-unstable'
+
+- name: add unstable repo
+  apt_repository:
+    repo: "deb http://http.debian.net/debian unstable main"
--- a/roles/repositories/tasks/debian.yml
+++ b/roles/repositories/tasks/debian.yml
@@ -3,19 +3,14 @@
 - name: add python-apt
   apt: name=python-apt state=installed
 
-# Not used here, but nice to have ready
-- name: add backports repo
-  apt_repository:
-    repo: "deb http://http.debian.net/debian {{ansible_distribution_release}}-backports main"
+- include: debian-stable.yml
+  when: ansible_distribution_release != 'NA'
   tags: repos
 
-- name: add pgdg repo
-  when: ansible_architecture in ["i386", "x86_64"]
-  apt_repository:
-    repo: "deb http://apt.postgresql.org/pub/repos/apt/ {{ansible_distribution_release}}-pgdg main"
+- include: debian-testing.yml
+  when: ansible_distribution_release == 'NA'
   tags: repos
 
 - name: apt upgrade
   apt: upgrade=yes update_cache=yes cache_valid_time=3600 
   tags: packages, upgrade
-
--- a/roles/repositories/tasks/main.yml
+++ b/roles/repositories/tasks/main.yml
@@ -1,5 +1,3 @@
 ---
-
 - include: debian.yml
   when: ansible_distribution == 'Debian'
-

mercurial