@installdoc/ansible-gas-station
Version:
An Ansible playbook that provisions your network with software from GitHub Awesome lists, developed with disaster recovery in mind ⛽🔥🤤
60 lines (52 loc) • 2.15 kB
YAML
- name: Ensure Megabyte Labs configuration directory exists
ansible.windows.win_file:
path: "{{ item }}"
state: directory
loop:
- '%USERPROFILE%\.config'
- '%USERPROFILE%\.config\megabytelabs'
- name: Check if AriaNG has configuration stored in '%USERPROFILE%/.config/megabytelabs/ariang'
ansible.windows.win_stat:
path: '%USERPROFILE%\.config\megabytelabs\ariang'
register: ariang_config
- name: Detect previously installed AriaNG version
ansible.windows.win_command: type ariang
args:
chdir: '%USERPROFILE%\.config\megabytelabs'
changed_when: false
register: current_ariang_version
when: ariang_config.stat.exists
- name: Detect the latest AriaNG version
ansible.windows.win_uri:
url: https://api.github.com/repos/mayswind/AriaNg/releases/latest
return_content: true
register: ariang_latest_release_tag
- name: Determine whether or not the latest version of AriaNG is already installed
set_fact:
install_ariang: "{{ (current_ariang_version.skipped | default(false)) or \
((not current_ariang_version.skipped | default(false)) and (current_ariang_version.stdout != ariang_latest_release_tag.json.tag_name)) }}"
- name: Ensure latest version of AriaNG is downloaded
ansible.windows.win_get_url:
url: "https://github.com/mayswind/AriaNg/releases/download/{{ ariang_latest_release_tag.json.tag_name }}/\
AriaNg-{{ ariang_latest_release_tag.json.tag_name }}-AllInOne.zip"
dest: '%TEMP%\ariang.zip'
when: install_ariang
- name: Ensure latest version of AriaNG is installed
become_user: "{{ user.username }}"
community.windows.win_unzip:
src: '%TEMP%\ariang.zip'
dest: '%USERPROFILE%\'
loop: "{{ user_configs }}"
loop_control:
label: "{{ user.username }}"
loop_var: user
when:
- install_ariang
- (user.system is not defined) or ((user.system is defined) and (not user.system))
- name: Save meta information about the version of AriaNG that was installed
ansible.windows.win_copy:
dest: '%USERPROFILE%\.config\megabytelabs\ariang'
content: |
{{ ariang_latest_release_tag.json.tag_name }}
when: install_ariang