diff --git a/tasks/archive/go.yml b/tasks/archive/go.yml index 94a1fbd..f7b53dc 100644 --- a/tasks/archive/go.yml +++ b/tasks/archive/go.yml @@ -13,11 +13,10 @@ - name: Install/update go when: - - do_go_install or + - (do_go_install is defined and do_go_install) or not stat_path_go.stat.exists block: - name: Download go archive - become: "{{ sys_pkg_become }}" register: get_url_go ansible.builtin.get_url: dest: "{{ d_tempdir.path }}/{{ go.archive }}" @@ -31,7 +30,7 @@ when: - ansible_system == 'Linux' ansible.builtin.unarchive: - dest: "{{ path.prefix }}" + dest: "{{ go.prefix }}" src: "{{ d_tempdir.path }}/{{ go.archive }}" remote_src: true @@ -40,4 +39,4 @@ when: - ansible_distribution == 'MacOSX' ansible.builtin.command: - cmd: "installer -pkg {{ d_tempdir.path }}/{{ go.archive }} -target /" + cmd: "installer -pkg {{ d_tempdir.path }}/{{ go.archive }} -target {{ go.prefix }}" diff --git a/tasks/archive/zig.yml b/tasks/archive/zig.yml index a15bcc0..0a6ac82 100644 --- a/tasks/archive/zig.yml +++ b/tasks/archive/zig.yml @@ -1,42 +1,38 @@ # vim: set filetype=yaml.ansible : --- -- name: Download zig archive - ansible.builtin.set_fact: - zig_path: "zig-{{ pkgconfig_zig.sysmap[ansible_system] }}-{{ pkgconfig_zig.archmap[ansible_architecture] }}-{{ pkgconfig_zig.version }}" - zig_pkg: "zig-{{ pkgconfig_zig.sysmap[ansible_system] }}-{{ pkgconfig_zig.archmap[ansible_architecture] }}-{{ pkgconfig_zig.version }}.tar.xz" - - name: Check if zig exists ansible.builtin.stat: - path: "{{ pkgconfig_zig.install_path }}/{{ zig_path }}/zig" + path: "{{ path.archive }}/zig/{{ zig.path }}/zig" register: r_zig_stat - name: Update/install zig when: - not r_zig_stat.stat.exists block: - - name: Create temp path - ansible.builtin.tempfile: - state: directory - prefix: zig_dl. - register: d_zig_dl_tmp - - name: Download zig archive ansible.builtin.get_url: - dest: "{{ d_zig_dl_tmp.path }}/{{ zig_pkg }}" - url: "{{ pkgconfig_zig.base_url }}/{{ pkgconfig_zig.version }}/{{ zig_pkg }}" + dest: "{{ d_tempdir.path }}/{{ zig.pkg }}" + url: "{{ zig.base_url }}/{{ zig.vers }}/{{ zig.pkg }}" decompress: false mode: '0644' + - name: Create zig archive dir + become: "{{ ext_become }}" + ansible.builtin.file: + state: directory + mode: '0755' + path: "{{ path.archive }}/zig" + - name: Extract zig package become: "{{ ext_become }}" ansible.builtin.unarchive: dest: "{{ path.archive }}/zig" - src: "{{ d_zig_dl_tmp.path }}/{{ zig_pkg }}" + src: "{{ d_tempdir.path }}/{{ zig.pkg }}" remote_src: true - name: Link zig binary become: "{{ ext_become }}" ansible.builtin.file: state: link - src: "{{ path.archive }}/{{ zig_path }}/zig" + src: "{{ path.archive }}/zig/{{ zig.path }}/zig" path: "{{ path.bin }}/zig" diff --git a/tasks/archive/zls.yml b/tasks/archive/zls.yml index 355d5f7..17e0189 100644 --- a/tasks/archive/zls.yml +++ b/tasks/archive/zls.yml @@ -1,32 +1,37 @@ # vim: set filetype=yaml.ansible : --- -- name: Download zls archive - ansible.builtin.set_fact: - - name: Check if zls exists ansible.builtin.stat: - path: "{{ path.archive }}/{{ zls_path }}/zls" + path: "{{ path.archive }}/zls/{{ zls.path }}/zls" register: r_zls_stat - name: Update/install zls block: - name: Download zls archive + register: get_url_zls ansible.builtin.get_url: - dest: "{{ d_tempfile.path }}/{{ zls_pkg }}" - url: "{{ zls.base_url }}/{{ zls_pkg }}" + dest: "{{ d_tempdir.path }}/{{ zls.pkg }}" + url: "{{ zls.base_url }}/{{ zls.pkg }}" decompress: false mode: '0644' + - name: Create zls archive dir + become: "{{ ext_become }}" + ansible.builtin.file: + state: directory + mode: '0755' + path: "{{ path.archive }}/zls/{{ zls.path }}" + - name: Extract zls package become: "{{ ext_become }}" ansible.builtin.unarchive: - dest: "{{ path.archive }}" - src: "{{ d_tempfile.path }}/{{ zls_pkg }}" + dest: "{{ path.archive }}/zls/{{ zls.path }}" + src: "{{ d_tempdir.path }}/{{ zls.pkg }}" remote_src: true - name: Link zls binary become: "{{ ext_become }}" ansible.builtin.file: state: link - src: "{{ path.archive }}/{{ zls_path }}/zls" + src: "{{ path.archive }}/zls/{{ zls.path }}/zls" path: "{{ path.bin }}/zls" diff --git a/tasks/cargo.yml b/tasks/cargo.yml index 7eb3a5c..dd788b8 100644 --- a/tasks/cargo.yml +++ b/tasks/cargo.yml @@ -3,7 +3,7 @@ - name: Install cargo pkg become: "{{ ext_become }}" community.general.cargo: - name: "{{ pkg.name }}" - version: "{{ pkg.vers }}" - path: "{{ paths.cargo }}" + name: "{{ pkg.name | default(pkg) }}" + version: "{{ pkg.vers | default(omit) }}" + path: "{{ paths.cargo | default(omit) }}" locked: "{{ pkg.locked | default(true) }}" diff --git a/tasks/config/air.yml b/tasks/config/air.yml deleted file mode 100644 index e5ee19e..0000000 --- a/tasks/config/air.yml +++ /dev/null @@ -1,8 +0,0 @@ -# vim: set filetype=yaml.ansible : ---- -- name: Set configuration for air - ansible.builtin.set_fact: - air: - ver: "{{ pkgconfig.air.version }}" - pkg: "{{ pkgconfig.air.mod_path }}@{{ pkgconfig.air.version }}" - bin: "{{ pkgconfig.air.bin }}" diff --git a/tasks/config/go.yml b/tasks/config/go.yml index cce458e..6be7b4e 100644 --- a/tasks/config/go.yml +++ b/tasks/config/go.yml @@ -16,7 +16,7 @@ arch: "{{ go.arch }}" archive: "go{{ go.vers }}.{{ go.sys }}-{{ go.arch }}.{{ pkgconfig.go.extmap[ansible_system] }}" ext: "{{ go.ext }}" - inst_path: "{{ path.prefix }}" + prefix: "{% if ansible_distribution == 'MacOSX' %}/{% else %}{{ path.prefix }}{% endif %}" sum: "{{ pkgconfig.go.sums[go.vers][ansible_system][go.arch] }}" sys: "{{ go.sys }}" base_url: "{{ pkgconfig.go.base_url }}" diff --git a/tasks/config/zig.yml b/tasks/config/zig.yml index ab09d5a..dcb875b 100644 --- a/tasks/config/zig.yml +++ b/tasks/config/zig.yml @@ -3,6 +3,7 @@ - name: Set zig configuration ansible.builtin.set_fact: zig: - version: 0.13.0 - install_prefix: "{{ path.prefix }}" - install_path: "{{ path.archive }}/zig" + vers: "{{ pkgconfig.zig.version }}" + path: "zig-{{ pkgconfig.zig.sysmap[ansible_system] }}-{{ pkgconfig.zig.archmap[ansible_architecture] }}-{{ pkgconfig.zig.version }}" + pkg: "zig-{{ pkgconfig.zig.sysmap[ansible_system] }}-{{ pkgconfig.zig.archmap[ansible_architecture] }}-{{ pkgconfig.zig.version }}.tar.xz" + base_url: "{{ pkgconfig.zig.base_url }}" diff --git a/tasks/facts.yml b/tasks/facts.yml index 5321479..f6a6d18 100644 --- a/tasks/facts.yml +++ b/tasks/facts.yml @@ -45,7 +45,7 @@ archive: "{{ path.archive | default(path.prefix ~ defaults.path.suffix.archive) }}" bin: "{{ path.bin | default(path.prefix ~ defaults.path.suffix.bin) }}" cargo: "{{ path.cargo | default(path.prefix ~ defaults.path.suffix.cargo) }}" - go: "{{ path.go | default(path.prefix ~ defaults.path.suffix.go) }}" + go: "{% if ansible_distribution == 'MacOSX' %}/usr/local/go{% else %}{{ path.go | default(path.prefix ~ defaults.path.suffix.go) }}{% endif %}" pipx: "{{ path.pipx | default(path.prefix ~ defaults.path.suffix.pipx) }}" - name: Set OS independant facts diff --git a/tasks/go.yml b/tasks/go.yml index 85cea83..ec173c2 100644 --- a/tasks/go.yml +++ b/tasks/go.yml @@ -1,12 +1,16 @@ --- +- debug: + var: path.go +- debug: + var: path.bin + - name: Install go packages become: "{{ ext_become }}" environment: - GOBIN: "{{ path.bin }}" + GOBIN: "{% if ansible_distribution == 'MacOSX' %}/usr/local/bin{% else %}{{ path.bin }}{% endif %}" PATH: "{{ path.go }}/bin:$PATH" ansible.builtin.command: - creates: "{{ path.bin }}/{{ pkg.bin }}" cmd: - go - install - - "{{ pkg.pkg }}" + - "{{ pkg }}" diff --git a/tasks/linux.yml b/tasks/linux.yml index fd6d5c6..cec1663 100644 --- a/tasks/linux.yml +++ b/tasks/linux.yml @@ -31,3 +31,13 @@ name: "{{ flatpak.name }}" remote: "{{ flatpak.remote | default('flathub') }}" state: present + +- name: Install pkg_appimage + when: + - pkg_appimage|length > 0 + loop: "{{ pkg_appimage }}" + loop_control: + loop_var: pkg + ansible.builtin.include_tasks: + file: appimage.yml + diff --git a/tasks/main.yml b/tasks/main.yml index b6e2809..1285033 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -72,15 +72,6 @@ ansible.builtin.include_tasks: file: "archive/{{ pkg }}.yml" -- name: Install pkg_appimage - when: - - pkg_appimage|length > 0 - loop: "{{ pkg_appimage }}" - loop_control: - loop_var: pkg - ansible.builtin.include_tasks: - file: appimage.yml - - name: Build and install source packages when: - pkg_src|length > 0 diff --git a/tasks/pkgs/air.yml b/tasks/pkgs/air.yml index 556db60..e9c0b87 100644 --- a/tasks/pkgs/air.yml +++ b/tasks/pkgs/air.yml @@ -4,4 +4,4 @@ notify: - Depend go ansible.builtin.set_fact: - pkg_go: "{{ pkg_go + [air] }}" + pkg_go: "{{ pkg_go + ['github.com/air-verse/air@latest'] }}" diff --git a/tasks/pkgs/zig.yml b/tasks/pkgs/zig.yml index dfdd026..4804ef5 100644 --- a/tasks/pkgs/zig.yml +++ b/tasks/pkgs/zig.yml @@ -2,4 +2,4 @@ --- - name: Append to pkgs ansible.builtin.set_fact: - pkg_src: "{{ pkg_src + ['zig'] }}" + pkg_archive: "{{ pkg_archive + ['zig'] }}" diff --git a/tasks/repos/hashicorp.yml b/tasks/repos/hashicorp.yml index e2e0167..a7e2bb1 100644 --- a/tasks/repos/hashicorp.yml +++ b/tasks/repos/hashicorp.yml @@ -61,4 +61,4 @@ when: - ansible_distribution == 'MacOSX' ansible.builtin.set_fact: - brewtaps: "{{ brewtaps + ['hashicorp/tap'] }}" + brewtap: "{{ brewtap + ['hashicorp/tap'] }}" diff --git a/vars/pkgs/air.yml b/vars/pkgs/air.yml deleted file mode 100644 index 9476287..0000000 --- a/vars/pkgs/air.yml +++ /dev/null @@ -1,4 +0,0 @@ -air: - version: latest - mod_path: github.com/air-verse/air - bin: air diff --git a/vars/pkgs/go.yml b/vars/pkgs/go.yml index f72ca9c..9a523ca 100644 --- a/vars/pkgs/go.yml +++ b/vars/pkgs/go.yml @@ -11,11 +11,11 @@ go: sums: 1.24.0: Darwin: - amd64: dee0ea64411a00b47ded586d5a8e30cfe3acf51564aa1bb24e039a6dca807a29 - arm64: b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 + amd64: sha256:dee0ea64411a00b47ded586d5a8e30cfe3acf51564aa1bb24e039a6dca807a29 + arm64: sha256:b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 Linux: - amd64: b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 - arm64: c3fa6d16ffa261091a5617145553c71d21435ce547e44cc6dfb7470865527cc7 + amd64: sha256:b19eb6b7ae87f8371c3e7a84d129db67779a2883d2fffa6bb90412b0167df133 + arm64: sha256:c3fa6d16ffa261091a5617145553c71d21435ce547e44cc6dfb7470865527cc7 1.23.6: Darwin: amd64: sha256:7fa387c228b4dd69b518a5d9425638fa5c0d86ec8943de373e3802aff2e5b12a diff --git a/vars/pkgs/zig.yml b/vars/pkgs/zig.yml index a74aba4..26b27e1 100644 --- a/vars/pkgs/zig.yml +++ b/vars/pkgs/zig.yml @@ -1,4 +1,5 @@ zig: + version: 0.13.0 base_url: https://ziglang.org/download sysmap: Darwin: macos