2022-11-09 14:54:18 +00:00
|
|
|
---
|
|
|
|
# tasks file for hugo
|
|
|
|
|
|
|
|
- name: Créer l'emplacement de stockage du binaire
|
|
|
|
ansible.builtin.file:
|
|
|
|
state: directory
|
|
|
|
path: "{{ hugo_binary_path }}"
|
|
|
|
mode: u=rwX,g=rX,o=rX
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Modifier l'URL pour pointer vers la version souhaitée
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
hugo_latest_url: "{{ hugo_latest_url | replace('latest', version) }}"
|
|
|
|
when: hugo_version != "latest"
|
|
|
|
vars:
|
|
|
|
version: "tags/v{{ hugo_version }}"
|
|
|
|
|
|
|
|
- name: Récupérer le contenu du fichier de version
|
|
|
|
ansible.builtin.uri:
|
|
|
|
url: "{{ hugo_latest_url }}"
|
|
|
|
return_content: true
|
|
|
|
follow_redirects: all
|
|
|
|
register: releases
|
|
|
|
|
|
|
|
- name: Extraire l'URL du paquet
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
browser_download_url: >
|
|
|
|
{{
|
|
|
|
releases.json.assets |
|
2023-06-18 10:38:30 +00:00
|
|
|
rejectattr('browser_download_url', 'search', 'extended', 'ignorecase=true') |
|
|
|
|
selectattr('browser_download_url', 'search', '.tar.gz', 'ignorecase=true') |
|
|
|
|
selectattr('browser_download_url', 'search', hugo_os, 'ignorecase=true') |
|
|
|
|
selectattr('browser_download_url', 'search', hugo_architecture, 'ignorecase=true') |
|
2022-11-09 14:54:18 +00:00
|
|
|
map(attribute='browser_download_url')
|
|
|
|
}}
|
|
|
|
|
|
|
|
- name: Extraire l'archive
|
|
|
|
ansible.builtin.unarchive:
|
|
|
|
src: "{{ browser_download_url | first }}"
|
|
|
|
dest: "{{ hugo_binary_path }}"
|
|
|
|
remote_src: true
|
|
|
|
list_files: true
|
|
|
|
mode: u=rwX,g=rX,o=rX
|
|
|
|
become: true
|
|
|
|
|
|
|
|
- name: Installer la commande
|
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: install -t /usr/local/bin /opt/hugo/hugo
|
|
|
|
when: hugo_install_command
|
|
|
|
become: true
|