92 lines
2.3 KiB
YAML
92 lines
2.3 KiB
YAML
---
|
|
- name: Validate the supported platform
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ansible_facts.distribution == "Ubuntu"
|
|
- ansible_facts.distribution_version == "26.04"
|
|
- ansible_facts.architecture in ["x86_64", "aarch64"]
|
|
fail_msg: Seriatim supports Ubuntu 26.04 on x86_64 or aarch64.
|
|
|
|
- name: Install Git
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name: git
|
|
state: present
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
when: seriatim_manage_build_dependencies
|
|
|
|
- name: Install Go
|
|
become: true
|
|
community.general.snap:
|
|
name: go
|
|
channel: "{{ seriatim_go_snap_channel }}"
|
|
classic: true
|
|
state: present
|
|
when: seriatim_manage_build_dependencies
|
|
|
|
- name: Create installation parent directories
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
owner: root
|
|
group: root
|
|
mode: "0755"
|
|
loop:
|
|
- "{{ seriatim_source_dir | dirname }}"
|
|
- "{{ seriatim_binary_path | dirname }}"
|
|
|
|
- name: Check out Seriatim source
|
|
become: true
|
|
ansible.builtin.git:
|
|
repo: "{{ seriatim_repository_url }}"
|
|
dest: "{{ seriatim_source_dir }}"
|
|
version: "{{ seriatim_version }}"
|
|
force: true
|
|
register: seriatim_checkout
|
|
|
|
- name: Inspect the installed binary
|
|
ansible.builtin.stat:
|
|
path: "{{ seriatim_binary_path }}"
|
|
register: seriatim_binary
|
|
|
|
- name: Build Seriatim
|
|
become: true
|
|
ansible.builtin.command:
|
|
argv:
|
|
- "{{ seriatim_go_binary }}"
|
|
- build
|
|
- -trimpath
|
|
- -ldflags
|
|
- "-s -w -X gitea.maximumdirect.net/eric/seriatim/internal/buildinfo.Version={{ seriatim_version }}"
|
|
- -o
|
|
- "{{ seriatim_binary_path }}"
|
|
- ./cmd/seriatim
|
|
chdir: "{{ seriatim_source_dir }}"
|
|
environment:
|
|
CGO_ENABLED: "0"
|
|
GOTOOLCHAIN: local
|
|
GOWORK: "off"
|
|
changed_when: true
|
|
when: >-
|
|
seriatim_checkout.changed or
|
|
not seriatim_binary.stat.exists
|
|
|
|
- name: Converge installed metadata
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: "{{ item.path }}"
|
|
state: "{{ item.state }}"
|
|
owner: root
|
|
group: root
|
|
mode: "{{ item.mode | default(omit) }}"
|
|
recurse: "{{ item.recurse | default(omit) }}"
|
|
loop:
|
|
- path: "{{ seriatim_source_dir }}"
|
|
state: directory
|
|
recurse: true
|
|
- path: "{{ seriatim_binary_path }}"
|
|
state: file
|
|
mode: "0755"
|