Working on source packages
Signed-off-by: Matthew Stobbs <matthew@stobbs.ca>
This commit is contained in:
@@ -8,51 +8,15 @@
|
||||
|
||||
- name: Set package_home_base for Linux
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
- ansible_system == 'Linux' or
|
||||
ansible_os_family == 'FreeBSD'
|
||||
ansible.builtin.set_fact:
|
||||
package_home_base: /home
|
||||
|
||||
- name: Set defaults paths
|
||||
ansible.builtin.set_fact:
|
||||
install_prefix: "{{ install_prefix | default(default_install_prefix) }}"
|
||||
default_store_path: "{{ ansible_user_dir }}/.cache/ansible_role_package"
|
||||
default_path_appimage: "{{ install_prefix | default(default_install_prefix) }}/appimage"
|
||||
default_path_archive: "{{ install_prefix | default(default_install_prefix) }}/archive"
|
||||
default_path_bin: "{{ install_prefix | default(default_install_prefix) }}/bin"
|
||||
default_path_cargo: "{{ install_prefix | default(default_install_prefix) }}/cargo"
|
||||
default_path_go: "{{ install_prefix | default(default_install_prefix) }}/go"
|
||||
default_path_pipx: "{{ install_prefix | default(default_install_prefix) }}/pipx"
|
||||
|
||||
- name: Set install variables
|
||||
ansible.builtin.set_fact:
|
||||
store_path: "{{ store_path | default(default_store_path) }}"
|
||||
path_appimage: "{{ path_appimage | default(default_path_appimage) }}"
|
||||
path_archive: "{{ path_archive | default(default_path_archive) }}"
|
||||
path_bin: "{{ path_bin | default(default_path_bin) }}"
|
||||
path_cargo: "{{ path_cargo | default(default_path_cargo) }}"
|
||||
path_go: "{{ path_go | default(default_path_go) }}"
|
||||
path_pipx: "{{ path_pipx | default(default_path_pipx) }}"
|
||||
|
||||
- name: Set OS independant facts
|
||||
ansible.builtin.set_fact:
|
||||
pkg_archive: [] # packages installed via prebuilt archive
|
||||
pkg_cargo: [] # rust packages from cargo using `cargo install`
|
||||
pkg_cargo_build: [] # rust packages using `cargo build` before install
|
||||
pkg_go: [] # go applications
|
||||
pkg_npm: [] # npm commands
|
||||
pkg_pipx: [] # pipx packages
|
||||
pkg_src: [] # packages built from source
|
||||
pkg_sys: [] # system package manager packages, homebrew on macOS, dnf for RedHat based, apt for Debian Based
|
||||
pkg_zig: [] # zig packages
|
||||
|
||||
- name: Set Linux specific facts
|
||||
when:
|
||||
- ansible_system == 'Linux'
|
||||
ansible.builtin.set_fact:
|
||||
flatpak_remotes: "{{ default_flatpak_remotes }}"
|
||||
pkg_appimage: [] # appimages to install
|
||||
pkg_flatpak: [] # flatpak packages to install
|
||||
pkg_snap: [] # snpacraft.io packages
|
||||
pipx_exec: "/usr/bin/pipx"
|
||||
path_lib: lib64
|
||||
root_prefix: /usr/local
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: "Add include task for {{ pkg }}"
|
||||
ansible.builtin.include_tasks:
|
||||
file: "pkgs/{{ pkg }}.yml"
|
||||
29
tasks/helpers/archive.yml
Normal file
29
tasks/helpers/archive.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Extract archive to given path
|
||||
block:
|
||||
- name: Ensure directory exists
|
||||
become: "{{ install_become }}"
|
||||
become_user: "{{ install_become_user }}"
|
||||
ansible.bulitin.file:
|
||||
state: directory
|
||||
path: "{{ extract_path }}"
|
||||
mode: "{{ install_prefix_mode }}"
|
||||
owner: "{{ install_prefix_owner }}"
|
||||
group: "{{ install_prefix_group }}"
|
||||
|
||||
- name: Download archive to cache
|
||||
ansible.builtin.get_url:
|
||||
dest: "{{ d_cache }}/{{ archive_name }}"
|
||||
url: "{{ archive_url }}"
|
||||
checksum: "{{ archive_checksum }}"
|
||||
decompress: false
|
||||
mode: '0644'
|
||||
|
||||
- name: Extract go archive
|
||||
ansible.builtin.unarchive:
|
||||
dest: "{{ extract_path }}"
|
||||
src: "{{ d_cache }}/{{ archive_name }}"
|
||||
remote_src: true
|
||||
include: "{{ archive_include | default(omit) }}"
|
||||
exclude: "{{ archive_exclude | default(omit) }}"
|
||||
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
|
||||
|
||||
@@ -1,36 +1,29 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Set air configuration
|
||||
- name: Set air configuration # {{{
|
||||
when:
|
||||
- __air_configured is undefined or
|
||||
not __air_configured
|
||||
block:
|
||||
- name: Set air_install_method
|
||||
- name: Set air install method
|
||||
when:
|
||||
- air_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
air_install_method: source
|
||||
air_install_method: "{% if install_method in air_install_methods %}{{ install_method }}{% else %}{{ air_install_method[0] }}{% endif %}"
|
||||
|
||||
- name: Set air version and url
|
||||
ansible.builtin.set_fact:
|
||||
air_version: "{{ air_version | default('latest') }}"
|
||||
air_url: "{{ air_url | default('github.com/air-verse/air') }}"
|
||||
air_install_url: "{{ air_install_url | default('github.com/air-verse/air') }}"
|
||||
|
||||
- name: Set air install path
|
||||
- name: Set air install package
|
||||
ansible.builtin.set_fact:
|
||||
air_pkg: "{{ air_url }}@{{ air_version }}"
|
||||
|
||||
- name: Ensure air_install_method is valid
|
||||
when:
|
||||
- air_install_method is defined
|
||||
- air_install_method not in air_install_methods
|
||||
ansible.builtin.set_fact:
|
||||
air_intall_method: air_install_methods[0]
|
||||
air_pkg: "{{ air_install_url }}@{{ air_version }}"
|
||||
|
||||
- name: Complete air configuration
|
||||
ansible.builtin.set_fact:
|
||||
__air_configured: true
|
||||
|
||||
# }}}
|
||||
- name: Append air to pkg_go
|
||||
when:
|
||||
- air_install_method == 'source'
|
||||
|
||||
@@ -5,128 +5,103 @@
|
||||
- __alacritty_configured is undefined or
|
||||
not __alacritty_configured
|
||||
block:
|
||||
- name: Set install method
|
||||
when:
|
||||
- alacritty_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_install_method: "{% if default_install_method in alacritty_install_methods %}{{ default_install_method }}{% else %}{{ alacritty_install_methods[0] }}{% endif %}"
|
||||
|
||||
- name: Set basic variables
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_version: v0.16.1
|
||||
alacritty_git_repo: https://github.com/alacritty/alacritty
|
||||
alacritty_pkgname: alacritty
|
||||
alacritty_version: "{{ alacritty_version | default('v0.16.1') }}"
|
||||
alacritty_git_repo: "{{ alacritty_git_repo | default('https://github.com/alacritty/alacritty') }}"
|
||||
alacritty_pkgname: "{{ alacritty_pkgname | default('alacritty') }}"
|
||||
alacritty_build_deps_extra: []
|
||||
|
||||
- name: Set install type
|
||||
- name: Configure alacritty source install
|
||||
when:
|
||||
- alacritty_install_method is undefined or
|
||||
alacritty_install_method == ''
|
||||
- alacritty_install_method == "source"
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_install_method: system
|
||||
alacritty_src_install:
|
||||
cargo_build_flags:
|
||||
- --release
|
||||
name: "{{ alacritty_pkgname }}"
|
||||
repo: "{{ alacritty_git_repo }}"
|
||||
version: "{{ alacritty_version }}"
|
||||
bin_output: "target/release/alacritty"
|
||||
bin_name: "alacritty"
|
||||
install_prefix: "{{ install_prefix }}"
|
||||
install_files:
|
||||
extra/logo/alacritty-term.svg: share/pixmaps/Alacritty.svg
|
||||
desktop_files:
|
||||
- extra/linux/Alacritty.desktop
|
||||
files_list:
|
||||
- bin/alacritty
|
||||
- share/pixmaps/Alacritty.svg
|
||||
alacritty_build_deps:
|
||||
RedHat:
|
||||
- cmake
|
||||
- fontconfig-devel
|
||||
- freetype-devel
|
||||
- g++
|
||||
- libxcb-devel
|
||||
- libxkbcommon-devel
|
||||
- desktop-file-utils
|
||||
Debian:
|
||||
- cmake
|
||||
- g++
|
||||
- pkg-config
|
||||
- libfontconfig1-dev
|
||||
- libxcb-xfixes0-dev
|
||||
- libxkbcommon-dev
|
||||
- python3
|
||||
- libfreetype6-dev
|
||||
- desktop-file-utils
|
||||
Alpine:
|
||||
- cmake
|
||||
- pkgconf
|
||||
- freetype-dev
|
||||
- fontconfig-dev
|
||||
- python3
|
||||
- libxcb-dev
|
||||
- g++
|
||||
- libxkbcommon-dev
|
||||
- desktop-file-utils
|
||||
Archlinux:
|
||||
- cmake
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkg-config
|
||||
- make
|
||||
- libxcb
|
||||
- libxkbcommon
|
||||
- python
|
||||
- desktop-file-utils
|
||||
FreeBSD:
|
||||
- cmake
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkgconf
|
||||
- python3
|
||||
- desktop-file-utils
|
||||
|
||||
- name: Install via source
|
||||
when:
|
||||
- alacritty_install_method is defined
|
||||
- alacritty_install_method == 'source' or
|
||||
install_method == 'source'
|
||||
block:
|
||||
- name: Configure alacritty source install
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_install_method: source
|
||||
alacritty_src_install:
|
||||
cargo_build_flags:
|
||||
- --release
|
||||
name: "{{ alacritty_pkgname }}"
|
||||
repo: "{{ alacritty_git_repo }}"
|
||||
version: "{{ alacritty_version }}"
|
||||
bin_output: "target/release/alacritty"
|
||||
bin_name: "alacritty"
|
||||
install_prefix: "{{ install_prefix }}"
|
||||
install_files:
|
||||
extra/logo/alacritty-term.svg: share/pixmaps/Alacritty.svg
|
||||
desktop_files:
|
||||
- extra/linux/Alacritty.desktop
|
||||
files_list:
|
||||
- bin/alacritty
|
||||
- share/pixmaps/Alacritty.svg
|
||||
|
||||
- name: Set alacritty install options
|
||||
- name: Set alacritty install extra build deps
|
||||
when:
|
||||
- alacritty_install_method == "source"
|
||||
- ansible_os_family == "RedHat"
|
||||
- ansible_os_major_version < 9
|
||||
block:
|
||||
- name: Set options for RedHat based Linux
|
||||
- name: Add extra dependencies for EL7
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
block:
|
||||
- name: Set common build dependencies
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps:
|
||||
- cmake
|
||||
- fontconfig-devel
|
||||
- freetype-devel
|
||||
- g++
|
||||
- libxcb-devel
|
||||
- libxkbcommon-devel
|
||||
- desktop-file-utils
|
||||
- ansible_distribution_major_version == 7
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps_extra: ['xcb-util-devel', '@Development Tools']
|
||||
|
||||
- name: Add extra dependencies for EL7
|
||||
when:
|
||||
- ansible_distribution_major_version == 7
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['xcb-util-devel', '@Development Tools'] }}"
|
||||
|
||||
- name: Add extra dependencies for EL8
|
||||
when:
|
||||
- ansible_distribution_major_version == 8
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps: "{{ alacritty_build_deps + ['@Development Tools'] }}"
|
||||
|
||||
- name: Set options for Debian based Linux
|
||||
- name: Add extra dependencies for EL8
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- ansible_distribution_major_version == 8
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps:
|
||||
- cmake
|
||||
- g++
|
||||
- pkg-config
|
||||
- libfontconfig1-dev
|
||||
- libxcb-xfixes0-dev
|
||||
- libxkbcommon-dev
|
||||
- python3
|
||||
- libfreetype6-dev
|
||||
- desktop-file-utils
|
||||
|
||||
- name: Set options for Archlinux
|
||||
when:
|
||||
- ansible_os_family == 'Archlinux'
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps:
|
||||
- cmake
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkg-config
|
||||
- make
|
||||
- libxcb
|
||||
- libxkbcommon
|
||||
- python
|
||||
- desktop-file-utils
|
||||
|
||||
- name: Set options for Alpine based Linux
|
||||
when: ansible_os_family == 'Alpine'
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps:
|
||||
- cmake
|
||||
- pkgconf
|
||||
- freetype-dev
|
||||
- fontconfig-dev
|
||||
- python3
|
||||
- libxcb-dev
|
||||
- g++
|
||||
- libxkbcommon-dev
|
||||
- desktop-file-utils
|
||||
|
||||
- name: Set options for FreeBSD
|
||||
when: ansible_os_family == 'FreeBSD'
|
||||
ansible.builtin.set_fact:
|
||||
alacritty_build_deps:
|
||||
- cmake
|
||||
- freetype2
|
||||
- fontconfig
|
||||
- pkgconf
|
||||
- python3
|
||||
- desktop-file-utils
|
||||
alacritty_build_deps_extra: ['@Development Tools']
|
||||
|
||||
- name: Complete alacritty configuration
|
||||
when: __alacritty_configured is undefined
|
||||
@@ -140,7 +115,7 @@
|
||||
when:
|
||||
- alacritty_method == 'source'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + alacritty_build_deps + ['git'] }}"
|
||||
pkg_sys: "{{ pkg_sys + alacritty_build_deps + alacritty_build_deps_extra + ['git'] }}"
|
||||
pkg_cargo_build: "{{ pkg_cargo_build + [alacritty_src_install] }}"
|
||||
|
||||
- name: Append alacritty to pkg_cask
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Append ansible to pkg_sys
|
||||
- name: Set maintainer
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['ansible'] }}"
|
||||
ansible_maintainers:
|
||||
- Matthew Stobbs
|
||||
- name: Configure ansible
|
||||
when:
|
||||
- __ansible_configured is undefined or
|
||||
not __ansible_configured
|
||||
block:
|
||||
- name: Set ansible install method
|
||||
when:
|
||||
- ansible_install_method is undefined
|
||||
ansible.bulitin.set_fact:
|
||||
ansible_install_method: "{% if install_method in ansible_install_methods %}{{ install_method }}{% else %}{{ ansible_install_methods[0] }}{% endif %}"
|
||||
ansible_pkgname:
|
||||
RedHat: ansible
|
||||
Debian: ansible
|
||||
Alpine: ansible
|
||||
Archlinux: ansible
|
||||
|
||||
- name: Complete ansible configuration
|
||||
ansible.builtin.set_fact:
|
||||
__ansible_configured: true
|
||||
|
||||
- name: Append ansible to system package manager install list
|
||||
when:
|
||||
- ansible_install_method == 'system'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + [ansible_pkgname[ansible_os_family]] }}"
|
||||
|
||||
- name: Append ansible to pipx install list
|
||||
|
||||
@@ -1,58 +1,54 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Configure ansible-lint
|
||||
- name: Configure ansible_lint
|
||||
when:
|
||||
- __ansible_lint_configured is undefined or
|
||||
not __ansible_lint_configured
|
||||
block:
|
||||
- name: Set basic variables
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_version: latest
|
||||
ansible_lint_version: "{{ ansible_lint_version | default('latest') }}"
|
||||
|
||||
- name: Configure package options
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_install_method: "{{ ansible_lint_install_method | default(install_method) }}"
|
||||
|
||||
- name: Set pipx name
|
||||
- name: Set ansible_lint install method
|
||||
when:
|
||||
- ansible_lint_install_method == 'pipx'
|
||||
- ansible_lint_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_install_method: "{% if install_method in ansible_lint_install_methods %}{{ install_method }}{% else %}{{ ansible_lint_install_methods[0] }}{% endif %}"
|
||||
|
||||
- name: Set pipx pkgnname
|
||||
when:
|
||||
- ansible_lint_install_method == 'pipx' or
|
||||
ansible_lint_install_method == 'system_pip'
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_pkgname: "{{ 'ansible_lint' if ansible_lint_version == 'latest' else 'ansible-lint==' ~ ansible_lint_version }}"
|
||||
|
||||
- name: Set package name
|
||||
when:
|
||||
- install_method == 'system'
|
||||
block:
|
||||
- name: Set package name RedHat/Debian/Alpine/Arch distros
|
||||
when:
|
||||
- ansible_os_family in ['RedHat', 'Debian', 'Alpine', 'Archlinux']
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_pkgname: ansible-lint
|
||||
|
||||
- name: Set package name for FreeBSD
|
||||
when:
|
||||
- ansible_os_family == 'FreeBSD'
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_pkgname: py311-ansible-lint
|
||||
|
||||
- name: Ensure ansible_lint_install_method is valid
|
||||
when:
|
||||
- ansible_lint_install_method not in ansible_lint_install_methods
|
||||
ansible.builtin.set_fact:
|
||||
ansible_lint_install_method: ansible_lint_install_methods[0]
|
||||
ansible_lint_pkgname:
|
||||
RedHat: ansible-lint
|
||||
Debian: ansible-lint
|
||||
Archlinux: ansible-lint
|
||||
Alpine: ansible-lint
|
||||
FreeBSD: py311-ansible-lint
|
||||
|
||||
- name: Complete ansible_lint configuration
|
||||
ansible.builtin.set_fact:
|
||||
__ansible_lint_configured: true
|
||||
|
||||
- name: Add ansible-lint to pipx install list
|
||||
- name: Add ansible_lint to pipx install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'pipx'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_pipx: "{{ pkg_pipx + [ansible_lint_pkgname] }}"
|
||||
|
||||
- name: Add ansible_lint to system_pip install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'system_pip'
|
||||
|
||||
- name: Append ansible-lint to system install list
|
||||
when:
|
||||
- ansible_lint_install_method == 'system'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + [ansible_lint_pkgname] }}"
|
||||
pkg_sys: "{{ pkg_sys + [ansible_lint_pkgname[ansible_os_family]] }}"
|
||||
|
||||
@@ -1,16 +1,78 @@
|
||||
# vim: set filetype=yaml.ansible :
|
||||
---
|
||||
- name: Load go config
|
||||
ansible.builtin.include_tasks:
|
||||
file: config/go.yml
|
||||
|
||||
- name: Append go to pkg_archive
|
||||
- name: Configure go for install
|
||||
when:
|
||||
- go.method == 'archive'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_archive: "{{ pkg_archive + ['go'] }}"
|
||||
- __go_configured is undefined
|
||||
block:
|
||||
- name: Configure go install method
|
||||
when:
|
||||
- go_install_method is undefined
|
||||
ansible.builtin.set_fact:
|
||||
go_install_method: "{% if install_method in go_install_methods %}{{ install_method }}{% else %}{{ go_install_methods[0] }}{% endif %}"
|
||||
|
||||
- name: Append to pkg_sys
|
||||
- go.method != 'archive'
|
||||
- name: Configure go archive installation
|
||||
when:
|
||||
- go_install_method == 'archive'
|
||||
block:
|
||||
- name: Configure go
|
||||
ansible.builtin.set_fact:
|
||||
go_version: "{{ go_version | default('1.25.6') }}"
|
||||
go_system: "{{ ansible_system | lower }}"
|
||||
go_archmap:
|
||||
arm64: arm64
|
||||
aarch64: arm64
|
||||
x86_64: amd64
|
||||
go_install_sums:
|
||||
1.25.6:
|
||||
Darwin:
|
||||
amd64: sha256:e2b5b237f5c262931b8e280ac4b8363f156e19bfad5270c099998932819670b7
|
||||
arm64: sha256:984521ae978a5377c7d782fd2dd953291840d7d3d0bd95781a1f32f16d94a006
|
||||
Linux:
|
||||
amd64: sha256:f022b6aad78e362bcba9b0b94d09ad58c5a70c6ba3b7582905fababf5fe0181a
|
||||
arm64: sha256:738ef87d79c34272424ccdf83302b7b0300b8b096ed443896089306117943dd5
|
||||
|
||||
- name: Set go architecture
|
||||
ansible.builtin.set_fact:
|
||||
go_arch: "{{ go_archmap[ansible_architecture] }}"
|
||||
|
||||
- name: Set archive name
|
||||
ansible.builtin.set_fact:
|
||||
go_archive: "go{{ go_version }}.{{ go_system }}-{{ go_arch }}.tar.gz"
|
||||
|
||||
- name: Set go download url
|
||||
ansible.builtin.set_fact:
|
||||
go_archive_url: "https://go.dev/dl/{{ go_archive }}"
|
||||
|
||||
- name: Set archive extract location
|
||||
ansible.builtin.set_fact:
|
||||
go_extract_path: "{{ path_archive }}/go{{ go_version }}"
|
||||
|
||||
- name: Complete go archive install configuration
|
||||
ansible.builtin.set_fact:
|
||||
__go_configured: true
|
||||
go_archive_install:
|
||||
extract_path: "{{ go_extract_path }}"
|
||||
archive_url: "{{ go_archive_url }}"
|
||||
archive_name: "{{ go_archive }}"
|
||||
archive_checksum: "{{ go_install_sums[go_version][ansible_system][go_arch] }}"
|
||||
|
||||
- name: Install vis system package manager
|
||||
when:
|
||||
- go_install_method == 'system'
|
||||
ansible.builtin.set_fact:
|
||||
pkg_sys: "{{ pkg_sys + ['go'] }}"
|
||||
|
||||
- name: Install via archive
|
||||
when:
|
||||
- go_install_method == 'archive'
|
||||
block:
|
||||
- name: Add go archive extract install
|
||||
ansible.builtin.set_fact:
|
||||
pkg_archive: "{{ pkg_archive + [go_archive_install] }}"
|
||||
|
||||
- name: Set symbolic link to archive path
|
||||
ansible.bulitin.file:
|
||||
state: link
|
||||
force: true
|
||||
path: "{{ path_go }}"
|
||||
src: "{{ got_extract_path }}/go"
|
||||
|
||||
Reference in New Issue
Block a user