Working on source packages
Signed-off-by: Matthew Stobbs <matthew@stobbs.ca>
This commit is contained in:
151
tasks/main.yml
151
tasks/main.yml
@@ -1,110 +1,89 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
# create all the facts used throughout the role, but shouldn't be touched
|
||||
# by the user
|
||||
- name: Create cache directory
|
||||
register: d_cache
|
||||
ansible.builtin.file:
|
||||
path: "{{ store_path }}"
|
||||
mode: '0777'
|
||||
owner: "{{ ansible_user_id }}"
|
||||
group: "{{ ansible_user_gid }}"
|
||||
state: directory
|
||||
|
||||
- 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: "{{ ansible_user_id }}"
|
||||
group: "{{ ansible_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_git }}"
|
||||
- "{{ path_pipx }}"
|
||||
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
|
||||
- name: Read package configuration
|
||||
ansible.builtin.include_vars:
|
||||
dir: pkgs
|
||||
extensions:
|
||||
- yml
|
||||
name: pkgconfig
|
||||
file: pkglist.yml
|
||||
|
||||
- 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:
|
||||
- ansible_distribution == 'Fedora'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + extra_packages }}"
|
||||
pkg_sys: "{{ packages_extra + ['python3-paramiko'] }}"
|
||||
|
||||
- name: Add needed MacOS packages
|
||||
when:
|
||||
- ansible_distribution == 'MacOSX'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ packages_extra + ['gnu-tar', 'virtualenv'] }}"
|
||||
|
||||
- name: Add needed Alpine packages
|
||||
when:
|
||||
- ansible_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 go if required
|
||||
when:
|
||||
- ansible_distribution == 'Fedora'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['python3-paramiko'] }}"
|
||||
- pkg_go|length > 0
|
||||
ansible.builtin.include_tasks:
|
||||
file: pkgs/go.yml
|
||||
|
||||
- name: Add needed MacOS packages
|
||||
- name: Install rust and cargo if required
|
||||
when:
|
||||
- ansible_distribution == 'MacOSX'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['gnu-tar', 'virtualenv'] }}"
|
||||
- pkg_cargo|length > 0 or
|
||||
pkg_cargo_build|length > 0
|
||||
ansible.builtin.include_tasks:
|
||||
file: pkgs/rust.yml
|
||||
|
||||
- name: Add needed Alpine packages
|
||||
- name: Ensure pipx is installed
|
||||
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
|
||||
- pkg_pipx|length > 0
|
||||
ansible.builtin.include_tasks:
|
||||
file: pkgs/pipx.yml
|
||||
|
||||
- name: Ensure pipx path exists
|
||||
when: pkg_pipx|length > 0
|
||||
@@ -141,12 +120,14 @@
|
||||
path: "{{ path.appimage }}"
|
||||
|
||||
- name: Ensure archive path exists
|
||||
when: pkg_archive|length > 0
|
||||
become: "{{ ext_become }}"
|
||||
when:
|
||||
- pkg_archive|length > 0
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
ansible.builtin.file:
|
||||
state: directory
|
||||
mode: '0755'
|
||||
path: "{{ path.archive }}"
|
||||
path: "{{ path_archive }}"
|
||||
|
||||
- name: Depend zig
|
||||
when: pkg_zig|length > 0
|
||||
|
||||
Reference in New Issue
Block a user