Преглед изворни кода

Make possible to add custom Debian repositories and packages

Emmanuel Bouthenot пре 9 година
родитељ
комит
f99cc153d6
2 измењених фајлова са 24 додато и 0 уклоњено
  1. 4 0
      roles/common/defaults/main.yml
  2. 20 0
      roles/common/tasks/base.yml

+ 4 - 0
roles/common/defaults/main.yml

@@ -14,6 +14,10 @@ timezone_city: 'Paris'
 
 debian_mirror: 'ftp://ftp.fr.debian.org/debian'
 
+apt_keys: Null
+apt_repositories: Null
+apt_additional_packages: Null
+
 hosts_deny_nfs: False
 host_deny_paranoid: False
 

+ 20 - 0
roles/common/tasks/base.yml

@@ -14,6 +14,21 @@
 - name: Write /etc/apt/apt.conf.d configuration files
   template: src=apt/apt-options.j2 dest=/etc/apt/apt.conf.d/90local owner=root group=root mode=0644
 
+- name: Install apt key for custom Debian repositories
+  apt_key:
+    id: '{{ item.id }}'
+    url: '{{ item.url }}'
+    state: 'present'
+  with_items: apt_keys
+  when: apt_keys
+
+- name: Add apt sources for custom Debian repositories
+  apt_repository:
+    repo: 'deb {{ item.uri }} {{ item.suite }} {{ item.sections }}'
+    state: 'present'
+  with_items: apt_repositories
+  when: apt_repositories
+
 - name: Remove deprecated apt options files
   file: path=/etc/apt/apt.conf.d/{{ item }} state=absent
   with_items:
@@ -47,6 +62,11 @@
     - etckeeper
     - sharutils
 
+- name: Install additional packages
+  apt: pkg={{ item }} install_recommends=no state=installed update_cache=yes
+  with_items: apt_additional_packages
+  when: apt_additional_packages
+
 - name: Install ntp daemon
   apt: pkg=ntp install_recommends=no state=installed update_cache=yes
   when: with_ntp