From 4d4fe3e5d332f81baeac395ddbe0314727bcba5a Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 29 Nov 2018 22:02:25 +0100 Subject: [PATCH] add base packages install --- defaults/main.yml | 4 ++++ tasks/main.yml | 5 +++-- tasks/packages.yml | 17 +++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 tasks/packages.yml diff --git a/defaults/main.yml b/defaults/main.yml index fabada9..383920c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,3 +13,7 @@ yum_cron_emit_via: stdio # baseurl: "http://download.fedoraproject.org/pub/epel/$releasever/$basearch/" # gpgkey: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-$releasever/" # enabled: True + +yum_packages_install: [] +yum_packages_uninstall: [] +yum_packages_extra_install: [] diff --git a/tasks/main.yml b/tasks/main.yml index 3253b3c..6469e9e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,3 +1,4 @@ --- -- import_tasks: yum_cron.yml -- import_tasks: repository.yml +- include_tasks: yum_cron.yml +- include_tasks: repository.yml +- include_tasks: packages.yml diff --git a/tasks/packages.yml b/tasks/packages.yml new file mode 100644 index 0000000..b730fc2 --- /dev/null +++ b/tasks/packages.yml @@ -0,0 +1,17 @@ +--- +- block: + - name: Remove common packages + package: + name: "{{ item }}" + state: absent + with_items: + - "{{ yum_packages_uninstall | default([]) }}" + + - name: Install common packages + package: + name: "{{ item }}" + state: present + with_items: + - "{{ yum_packages_install | default([]) }} + {{ yum_packages_extra_install | default([]) }}" + become: True + become_user: root