# vim: set filetype=yaml.ansible : --- - name: Configure go for install when: - __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: Configure go system installation when: - go_install_method == 'system' block: - name: Set go pkgname for linux when: - ansible_system == 'Linux' ansible.builtin.set_fact: go_pkgname: "{{ go_pkgname[ansible_os_family] }}" - name: Set go pkgname for FreeBSD when: - ansible_os_family == 'FreeBSD' ansible.bulitin.set_fact: go_pkgname: "{{ go_pkgname[ansible_os_family][go_bsd_version] | default(go_pkgname[ansible_os_family]['default']) }}" - name: Set go pkgname for Darwin/MacOS when: - ansible_os_family == 'Darwin' ansible.builtin.set_fact: go_pkgname: "{{ go_pkgname[ansible_os_family] }}" - name: Configure go archive installation when: - go_install_method == 'archive' block: - name: Configure go ansible.builtin.set_fact: go_system: "{{ ansible_system | lower }}" - name: Set go architecture ansible.builtin.set_fact: go_arch: "{{ go_archmap[ansible_architecture] }}" - name: Set archive name ansible.builtin.set_fact: go_archive_file: "go{{ go_archive_version }}.{{ go_system }}-{{ go_arch }}.tar.gz" - name: Set go archive url and path ansible.builtin.set_fact: go_archive_url: "https://go.dev/dl/{{ go_archive_file }}" go_extract_path: "{{ path_archive }}/go{{ go_archive_version }}" - name: Finalize go archive install ansible.builtin.set_fact: go_archive_install: extract_path: "{{ go_extract_path }}" archive_url: "{{ go_archive_url }}" archive_name: "{{ go_archive }}" archive_checksum: "{{ go_archive_sums[go_archive_version][ansible_system][go_arch] }}" link_bin: - from: "{{ go_archive_path }}/go" to: "{{ path_go }}" force: true - from: "{{ path_go }}/bin/go" to: "{{ path_bin }}/go" force: true - name: Queue go install block: - name: Go system package install when: - go_install_method == 'system' ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + [go_pkgname] }}" - 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: "{{ go_extract_path }}/go" - name: Complete go archive install configuration ansible.builtin.set_fact: __go_configured: true