Squash merge move_to_single_file_pkgs into main
This commit is contained in:
262
tasks/main.yml
262
tasks/main.yml
@@ -1,213 +1,126 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
# create all the facts used throughout the role, but shouldn't be touched
|
||||
# by the user
|
||||
- name: Create temporary directory for downloads
|
||||
register: d_tempdir
|
||||
ansible.builtin.file:
|
||||
path: /tmp/ansible_role_package
|
||||
state: directory
|
||||
mode: '0777'
|
||||
- name: Show indev warning
|
||||
ansible.builtin.debug:
|
||||
msg: "This software is in development. Use at your own risk"
|
||||
|
||||
- name: Set installation facts
|
||||
ansible.builtin.include_tasks:
|
||||
file: facts.yml
|
||||
|
||||
- name: Ensure directory exists {{ path.prefix }}
|
||||
become: "{{ ext_become }}"
|
||||
- name: Create cache directory
|
||||
register: d_cache
|
||||
ansible.builtin.file:
|
||||
path: "{{ store_path }}"
|
||||
mode: '0755'
|
||||
owner: "{{ user_id }}"
|
||||
group: "{{ user_gid }}"
|
||||
state: directory
|
||||
|
||||
- name: Ensure required paths exists
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
loop:
|
||||
- "{{ install_prefix }}"
|
||||
- "{{ path_appimage }}"
|
||||
- "{{ path_archive }}"
|
||||
- "{{ path_bin }}"
|
||||
- "{{ path_cargo }}"
|
||||
- "{{ path_source }}"
|
||||
- "{{ path_zig }}"
|
||||
loop_control:
|
||||
loop_var: path
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.prefix }}"
|
||||
owner: "{{ install_prefix_owner }}"
|
||||
group: "{{ install_prefix_group }}"
|
||||
path: "{{ path }}"
|
||||
|
||||
- name: Ensure directory exists {{ path.bin }}
|
||||
become: "{{ ext_become }}"
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.bin }}"
|
||||
|
||||
- name: Read default package configuration
|
||||
ansible.builtin.include_vars:
|
||||
dir: pkgs
|
||||
extensions:
|
||||
- yml
|
||||
name: pkgconfig
|
||||
|
||||
- name: Read default package configuration
|
||||
ansible.builtin.include_vars:
|
||||
dir: src
|
||||
extensions:
|
||||
- yml
|
||||
name: srcconfig
|
||||
|
||||
- name: Append system_packages to pkg_sys
|
||||
- name: Add needed packages for Fedora
|
||||
when:
|
||||
- distribution == 'Fedora'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + extra_packages }}"
|
||||
pkg_sys: "{{ packages_extra + ['python3-paramiko'] }}"
|
||||
|
||||
- name: Add needed MacOS packages
|
||||
when:
|
||||
- distribution == 'MacOSX'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ packages_extra + ['gnu-tar', 'virtualenv'] }}"
|
||||
|
||||
- name: Add needed Alpine packages
|
||||
when:
|
||||
- os_family == 'Alpine'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ packages_extra + ['tar', 'unzip'] }}"
|
||||
|
||||
- name: Append extra packages to system install list
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + packages_extra }}"
|
||||
|
||||
- name: Generate package installation lists
|
||||
loop: "{{ packages | unique }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks:
|
||||
file: addpkg.yml
|
||||
file: "pkgs/{{ pkg }}.yml"
|
||||
|
||||
- name: Flush handlers to ensure dependencies are installed
|
||||
ansible.builtin.meta: flush_handlers
|
||||
|
||||
- name: Add needed packages for Fedora
|
||||
- name: Install pkg_sys list using system package manager
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['python3-paramiko'] }}"
|
||||
|
||||
- name: Add needed MacOS packages
|
||||
when:
|
||||
- ansible_distribution == 'MacOSX'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['gnu-tar', 'virtualenv'] }}"
|
||||
|
||||
- name: Add needed Alpine packages
|
||||
when:
|
||||
- ansible_os_family == 'Alpine'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['tar', 'unzip'] }}"
|
||||
|
||||
- name: Ensure extra dependencies are installed
|
||||
block:
|
||||
- name: Ensure go binary is installed
|
||||
when: pkg_go|length > 0
|
||||
vars:
|
||||
pkg: go
|
||||
ansible.builtin.include_tasks:
|
||||
file: addpkg.yml
|
||||
|
||||
- name: Ensure go path exists
|
||||
become: "{{ ext_become }}"
|
||||
when: pkg_go|length > 0
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.go }}"
|
||||
|
||||
- name: Ensure rust and cargo are installed
|
||||
when: pkg_cargo|length > 0
|
||||
vars:
|
||||
pkg: rust
|
||||
ansible.builtin.include_tasks:
|
||||
file: addpkg.yml
|
||||
|
||||
- name: Ensure pipx is installed
|
||||
when: pkg_pipx|length > 0
|
||||
vars:
|
||||
pkg: pipx
|
||||
ansible.builtin.include_tasks:
|
||||
file: addpkg.yml
|
||||
|
||||
- name: Ensure pipx path exists
|
||||
when: pkg_pipx|length > 0
|
||||
become: "{{ ext_become }}"
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.pipx }}"
|
||||
|
||||
- name: Ensure nodejs and npm are installed
|
||||
when: pkg_npm|length > 0
|
||||
vars:
|
||||
pkg: nodejs
|
||||
ansible.builtin.include_tasks:
|
||||
file: addpkg.yml
|
||||
|
||||
- name: Ensure flatpak is installed
|
||||
when:
|
||||
- pkg_flatpak is defined
|
||||
- pkg_flatpak|length > 0
|
||||
vars:
|
||||
pkg: flatpak
|
||||
ansible.builtin.include_tasks:
|
||||
file: addpkg.yml
|
||||
|
||||
- name: Ensure appimage path exists
|
||||
when:
|
||||
- pkg_appimage is defined
|
||||
- pkg_appimage|length > 0
|
||||
become: "{{ ext_become }}"
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.appimage }}"
|
||||
|
||||
- name: Ensure archive path exists
|
||||
when: pkg_archive|length > 0
|
||||
become: "{{ ext_become }}"
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.archive }}"
|
||||
|
||||
- name: Depend zig
|
||||
when: pkg_zig|length > 0
|
||||
vars:
|
||||
pkg: zig
|
||||
ansible.builtin.include_tasks:
|
||||
file: addpkg.yml
|
||||
|
||||
- name: Install sys_pkgs list using system package manager
|
||||
become: "{{ sys_pkg_become }}"
|
||||
- pkg_sys|length > 0
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
ansible.builtin.package:
|
||||
name: "{{ pkg_sys | unique }}"
|
||||
state: present
|
||||
|
||||
- name: Linux specific tasks
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
ansible.builtin.include_tasks:
|
||||
file: linux.yml
|
||||
- system == 'Linux'
|
||||
ansible.builtin.include_tasks: linux.yml
|
||||
|
||||
- name: MacOS specific tasks
|
||||
when:
|
||||
- ansible_distribution == 'MacOSX'
|
||||
ansible.builtin.include_tasks:
|
||||
file: macos.yml
|
||||
- distribution == 'MacOSX'
|
||||
ansible.builtin.include_tasks: macos.yml
|
||||
|
||||
- name: Install pkg_archive
|
||||
when:
|
||||
- pkg_archive|length > 0
|
||||
loop: "{{ pkg_archive }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks:
|
||||
file: "archive/{{ pkg }}.yml"
|
||||
block:
|
||||
- name: Install archives
|
||||
loop: "{{ pkg_archive }}"
|
||||
loop_control:
|
||||
loop_var: archive
|
||||
ansible.builtin.include_tasks: helpers/archive.yml
|
||||
|
||||
- name: Install cargo packages
|
||||
when:
|
||||
- pkg_cargo|length > 0
|
||||
- pkg_cargo|length > 0 or
|
||||
pkg_cargo_build|length > 0
|
||||
block:
|
||||
- name: Ensure cargo path exists
|
||||
become: "{{ ext_become }}"
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.cargo }}"
|
||||
|
||||
- name: Install cargo packages
|
||||
loop: "{{ pkg_cargo | unique }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks:
|
||||
file: cargo.yml
|
||||
ansible.builtin.include_tasks: helpers/cargo.yml
|
||||
|
||||
- name: Install cargo_build packages
|
||||
loop: "{{ pkg_cargo_build | unique }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks: helpers/cargo_build.yml
|
||||
|
||||
- name: Install go packages
|
||||
when:
|
||||
- pkg_go|length > 0
|
||||
block:
|
||||
- name: Install go pkgs
|
||||
loop: "{{ pkg_go | unique }}"
|
||||
loop: "{{ pkg_go }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks:
|
||||
file: go.yml
|
||||
ansible.builtin.include_tasks: helpers/go_install.yml
|
||||
|
||||
- name: Install local npm packages
|
||||
when:
|
||||
@@ -215,31 +128,24 @@
|
||||
loop: "{{ pkg_npm | unique }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks:
|
||||
file: npm.yml
|
||||
ansible.builtin.include_tasks: helpers/npm.yml
|
||||
|
||||
- name: Install python pipx packages for user
|
||||
- name: Install python pipx packages
|
||||
when:
|
||||
- pkg_pipx|length > 0
|
||||
loop: "{{ pkg_pipx | unique }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks:
|
||||
file: pipx.yml
|
||||
ansible.builtin.include_tasks: helpers/pipx.yml
|
||||
|
||||
- name: Build and install source packages
|
||||
- name: Build and install make packages
|
||||
when:
|
||||
- pkg_src|length > 0
|
||||
loop: "{{ pkg_src | unique }}"
|
||||
- pkg_make|length > 0
|
||||
loop: "{{ pkg_make | unique }}"
|
||||
loop_control:
|
||||
loop_var: pkg
|
||||
ansible.builtin.include_tasks:
|
||||
file: "src/{{ pkg }}.yml"
|
||||
ansible.builtin.include_tasks: helpers/make.yml
|
||||
|
||||
- name: Cleanup {{ d_tempdir.path }}
|
||||
become: true
|
||||
when:
|
||||
- not debug
|
||||
ansible.builtin.file:
|
||||
state: absent
|
||||
path: "{{ d_tempdir.path }}"
|
||||
- name: Dump __configured
|
||||
ansible.builtin.debug:
|
||||
var: __configured
|
||||
|
||||
Reference in New Issue
Block a user