From 01933baac4e8797ebd19b5aae449891eb7d85798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 17 Aug 2017 15:45:11 +0200 Subject: [PATCH] Move tasks to differents files. --- tasks/main.yml | 70 ++++++++++-------------------------------- tasks/packages.yml | 19 ++++++++++++ tasks/preferences.yml | 8 +++++ tasks/repositories.yml | 34 ++++++++++++++++++++ 4 files changed, 78 insertions(+), 53 deletions(-) create mode 100644 tasks/packages.yml create mode 100644 tasks/preferences.yml create mode 100644 tasks/repositories.yml diff --git a/tasks/main.yml b/tasks/main.yml index d7ea0c5..ccc86f8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,58 +1,22 @@ --- # tasks file for apt -# Default preferences file -- name: CONFIG default preferences - template: - src: '{{ apt_default_pref_tpl }}' - dest: '{{ apt_default_pref_path }}' +- include: preferences.yml + tags: + - system + - apt + - preferences + - apt-manage -# Sources list {{{ -## Purge sources.list file -- name: CONFIG remove sources.list file - file: - path: /etc/apt/sources.list - state: absent - notify: aptitude update - when: apt_purge_src_list_file +- include: repositories.yml + tags: + - system + - apt + - repository + - apt-manage -## Stretch -- name: CONFIG stretch official sources.list - apt_repository: - repo: "{{ item }} http://httpredir.debian.org/debian/ stretch main contrib non-free" - filename: stretch - update_cache: no - with_items: - - deb - - deb-src - notify: aptitude update - when: apt_src_list_manage and apt_stretch_manage - -- name: CONFIG stretch backports sources.list - apt_repository: - repo: "deb http://httpredir.debian.org/debian/ stretch-{{ item }} main contrib non-free" - filename: stretch.bpo - update_cache: no - with_items: - - backports - notify: aptitude update - when: apt_src_list_manage and apt_stretch_manage -# }}} - -# Packages {{{ -- name: Ensure useful tools packages - apt: - name: '{{ item }}' - state: '{{ apt_tools_state }}' - with_items: - - '{{ apt_tools_list }}' - when: apt_tools_manage - -- name: Ensure to purge useless packages - apt: - name: '{{ item }}' - state: '{{ apt_old_pkg_state }}' - with_items: - - '{{ apt_old_pkg_list }}' - when: apt_old_pkg_manage -# }}} +- include: packages.yml + tags: + - system + - apt + - packages diff --git a/tasks/packages.yml b/tasks/packages.yml new file mode 100644 index 0000000..a49a1cc --- /dev/null +++ b/tasks/packages.yml @@ -0,0 +1,19 @@ +--- +# tasks file for packages + +# Packages +- name: Ensure useful tools packages + apt: + name: '{{ item }}' + state: '{{ apt_tools_state }}' + with_items: + - '{{ apt_tools_list }}' + when: apt_tools_manage + +- name: Ensure to purge useless packages + apt: + name: '{{ item }}' + state: '{{ apt_old_pkg_state }}' + with_items: + - '{{ apt_old_pkg_list }}' + when: apt_old_pkg_manage diff --git a/tasks/preferences.yml b/tasks/preferences.yml new file mode 100644 index 0000000..cf804aa --- /dev/null +++ b/tasks/preferences.yml @@ -0,0 +1,8 @@ +--- +# task file for preferences + +# Default preferences file +- name: CONFIG default preferences + template: + src: '{{ apt_default_pref_tpl }}' + dest: '{{ apt_default_pref_path }}' diff --git a/tasks/repositories.yml b/tasks/repositories.yml new file mode 100644 index 0000000..d2e1c99 --- /dev/null +++ b/tasks/repositories.yml @@ -0,0 +1,34 @@ +--- +# tasks file for repositories + +# Sources list +## Purge sources.list file +- name: CONFIG remove sources.list file + file: + path: /etc/apt/sources.list + state: absent + notify: aptitude update + when: apt_purge_src_list_file + +## Stretch {{{ +- name: CONFIG stretch official sources.list + apt_repository: + repo: "{{ item }} http://httpredir.debian.org/debian/ stretch main contrib non-free" + filename: stretch + update_cache: no + with_items: + - deb + - deb-src + notify: aptitude update + when: apt_src_list_manage and apt_stretch_manage + +- name: CONFIG stretch backports sources.list + apt_repository: + repo: "deb http://httpredir.debian.org/debian/ stretch-{{ item }} main contrib non-free" + filename: stretch.bpo + update_cache: no + with_items: + - backports + notify: aptitude update + when: apt_src_list_manage and apt_stretch_manage +# }}}