diff options
author | binary <me@rgoncalves.se> | 2021-03-26 10:00:42 +0000 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2021-03-26 10:00:42 +0000 |
commit | a35e845ba2f7205fee084b17956e8840d5c02633 (patch) | |
tree | 7973e5f653874b6bc4225b9c2e56d2110b2958f4 /roles/_workstation/packages/tasks | |
parent | 0381093fe06534fd6b92ad6657e472acb0664f53 (diff) | |
download | infrastructure-a35e845ba2f7205fee084b17956e8840d5c02633.tar.gz |
Packages are now managed with ansible builtin and sub-array
Diffstat (limited to 'roles/_workstation/packages/tasks')
-rw-r--r-- | roles/_workstation/packages/tasks/main.yml | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/roles/_workstation/packages/tasks/main.yml b/roles/_workstation/packages/tasks/main.yml index 798eafa..20afce5 100644 --- a/roles/_workstation/packages/tasks/main.yml +++ b/roles/_workstation/packages/tasks/main.yml @@ -4,46 +4,18 @@ --- -- name: install packages for Archlinux - shell: | - pacman --noconfirm --needed -Sy {{ item | join(" ") }} +- name: install distribution packages + package: + name: "{{ item }}" + state: present loop: - - "{{ pkgs_common }}" - - "{{ pkgs_archlinux }}" - no_log: true - register: out - ignore_errors: true - when: ansible_distribution == "Archlinux" + - "{{ pkgs.common }}" + - "{{ pkgs[ansible_distribution | lower] }}" -- name: install packages for OpenBSD - shell: pkg_add -z {{ item | join(" ") }} - loop: - - "{{ pkgs_common }}" - - "{{ pkgs_openbsd }}" - no_log: true - register: out - ignore_errors: true - when: ansible_distribution == "OpenBSD" - -- name: packages installation output - debug: - msg: | - {% for item in out.results %} - - {{ item.cmd }} - {% for type in ["stdout_lines", "stderr_lines"] if item[type] %} - -- {{ type }} - {% for line in item[type] %} - --- {{ line }} - {% endfor %} - {% endfor %} - {% endfor %} - when: out is defined - -- name: show installation informations - debug: - msg: | - {% if out is defined %} - Installed all packages for system : {{ ansible_distribution }} - {% else %} - No installation methode for system : {{ ansible_distribution }}. Please patch and commit. - {% endif %} +- name: install system packages + package: + name: "{{ item }}" + state: present + loop: + - "{{ pkgs[ansible_system | lower] }}" + when: ansible_system in "Linux" |