UNPKG

@installdoc/ansible-gas-station

Version:

An Ansible playbook that provisions your network with software from GitHub Awesome lists, developed with disaster recovery in mind ⛽🔥🤤

69 lines (59 loc) 2.12 kB
--- - name: Ensure Megabyte Labs configuration directory exists file: mode: 0700 path: "{{ item }}" state: directory loop: - ~/.config - ~/.config/megabytelabs - name: "Check if {{ app_name }} has configuration stored in ~/.config/megabytelabs/mcfly" stat: path: "~/.config/megabytelabs/mcfly" register: mcfly_config - name: "Detect previously installed {{ app_name }} version" command: cat mcfly args: chdir: ~/.config/megabytelabs changed_when: false register: current_mcfly_version when: mcfly_config.stat.exists - name: "Detect the latest {{ app_name }} version" uri: url: https://api.github.com/repos/cantino/mcfly/releases/latest register: mcfly_latest_release_tag - name: "Determine whether or not the latest version of {{ app_name }} is already installed" set_fact: install_mcfly: "{{ (current_mcfly_version.skipped | default(false)) or \ ((not current_mcfly_version.skipped | default(false)) and (current_mcfly_version.stdout != mcfly_latest_release_tag.json.tag_name | replace('v',''))) }}" - name: Ensure completions directory exists file: path: /usr/local/src/mcfly/ state: directory mode: 0755 - name: "Ensure older version of {{ app_name }} is uninstalled" file: path: /usr/local/bin/mcfly state: absent when: install_mcfly - name: "Ensure {{ app_name }} is downloaded and up-to-date" unarchive: src: "https://github.com/cantino/mcfly/releases/download/{{ mcfly_latest_release_tag.json.tag_name }}/\ mcfly-{{ mcfly_latest_release_tag.json.tag_name }}-x86_64-unknown-linux-musl.tar.gz" dest: /usr/local/src/mcfly/ remote_src: true when: install_mcfly - name: "Ensure {{ app_name }} is installed" copy: src: /usr/local/src/mcfly/mcfly dest: /usr/local/bin/mcfly mode: 0755 remote_src: true when: install_mcfly - name: "Save meta information about the version of {{ app_name }} that was installed" copy: dest: ~/.config/megabytelabs/mcfly mode: 0600 content: | {{ mcfly_latest_release_tag.json.tag_name | replace('v','') }} when: install_mcfly