Files
ansible_role_package/tasks/main.yml
2025-02-20 15:03:54 -07:00

99 lines
2.2 KiB
YAML

# vim: set filetype=yaml.ansible :
---
# create all the facts used throughout the role, but shouldn't be touched
# by the user
- name: Set installation facts
ansible.builtin.include_tasks:
file: facts.yml
- name: Ensure required path exist
become: "{{ ext_become }}"
loop: "{{ path | dict2items }}"
loop_control:
loop_var: p
ansible.builtin.file:
state: directory
mode: '0755'
path: "{{ p.value }}"
- name: Read default package configuration
ansible.builtin.include_vars:
dir: pkgs
extensions:
- yml
name: pkgconfig
- name: Generate package installation lists
loop: "{{ packages | unique }}"
loop_control:
loop_var: pkg
ansible.builtin.include_tasks:
file: addpkg.yml
- name: Install sys_pkgs list using system package manager
become: "{{ sys_pkg_become }}"
ansible.builtin.package:
name: "{{ sys_pkgs | unique }}"
state: present
- name: Linux based OS
when: ansible_system == 'Linux'
ansible.builtin.include_tasks:
file: linux.yml
- name: Darwin/macOS based OS
when: ansible_distribution == 'MacOSX'
ansible.builtin.include_tasks:
file: macos.yml
- name: Install archive_pkgs
when:
- archive_pkgs|length > 0
loop: "{{ archive_pkgs }}"
loop_control:
loop_var: pkg
ansible.builtin.include_tasks:
file: "archive/{{ pkg }}.yml"
- name: Build and install source packages
when:
- src_pkgs|length > 0
loop: "{{ src_pkgs | unique }}"
loop_control:
loop_var: pkg
ansible.builtin.include_tasks:
file: "src/{{ pkg }}.yml"
- name: Install cargo packages
when:
- cargo_pkgs|length > 0
loop: "{{ cargo_pkgs | unique }}"
loop_control:
loop_var: pkg
ansible.builtin.include_tasks:
file: cargo.yml
- name: Install go packages
when:
- go_pkgs|length > 0
loop: "{{ go_pkgs | unique }}"
loop_control:
loop_var: pkg
ansible.builtin.include_tasks:
file: go.yml
- name: Install local npm packages
loop: "{{ npmpkgs | unique }}"
loop_control:
loop_var: pkg
ansible.builtin.include_tasks:
file: npm.yml
- name: Install python pipx packages for user
loop: "{{ pipx_pkgs | unique }}"
loop_control:
loop_var: pkg
when: pipx_pkgs|length > 0
ansible.builtin.include_tasks:
file: pipx.yml