๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/tasks/includes/package.yml

36 lines
1.6 KiB

- name: determine package name
set_fact:
this_package: "{%- if package_inner is string -%}{{ package_inner }}\
{%- elif package_inner[ansible_distribution | lower] is defined -%}{{ package_inner[ansible_distribution | lower] }}\
{%- elif package_inner[ansible_system | lower] is defined -%}{{ package_inner[ansible_system | lower] }}\
{%- elif package_inner.default is defined -%}{{ package_inner.default }}\
{%- elif package_inner.name is defined -%}{{ package_inner.name }}\
{%- else -%}{{ None }}\
{%- endif -%}"
- block:
- name: install package
package:
name: "{{ this_package }}"
when: (ansible_system != 'Win32NT') and ((repository is not defined) or (repository == None))
notify: "{{ notify | d(omit) }}"
- name: install apk package from custom repository
community.general.apk:
name: "{{ this_package }}"
repository: "{{ (package_inner.repository | d(repository)) if package_inner is mapping else repository }}"
when: (ansible_system != 'Win32NT') and ((repository is defined) and (repository != None) or
(package_inner is mapping) and (package_inner.repository is defined) and (package_inner.repository != None))
notify: "{{ notify | d(omit) }}"
- name: install windows package
win_chocolatey:
name: "{{ this_package }}"
state: latest
when: ansible_system == 'Win32NT'
notify: "{{ notify | d(omit) }}"
when: (this_package | d(None) != None) and (this_package != "")