feat(cinny): add ansible role
This commit is contained in:
46
roles/cinny/tasks/deploy-tarball.yml
Normal file
46
roles/cinny/tasks/deploy-tarball.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
- name: Check if running cinny version is saved on host
|
||||
ansible.builtin.stat:
|
||||
path: "{{ cinny_running_version_file }}"
|
||||
register: cinny_running_version_st
|
||||
|
||||
- name: Retrieve running cinny version
|
||||
ansible.builtin.slurp:
|
||||
path: "{{ cinny_running_version_file }}"
|
||||
register: cinny_running_version_info
|
||||
when: cinny_running_version_st.stat.exists
|
||||
|
||||
- name: Extract running cinny version
|
||||
set_fact:
|
||||
cinny_is_update: >-
|
||||
{{ not cinny_running_version_st.stat.exists or
|
||||
(cinny_version is version(cinny_running_version, 'gt', version_type='semver')) }}
|
||||
vars:
|
||||
cinny_running_version: >-
|
||||
{{ (cinny_running_version_info is defined)
|
||||
| ternary(cinny_running_version_info['content'] | b64decode, false) }}
|
||||
|
||||
- name: Download tarball from GitHub release page
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ cinny_tarball_url }}"
|
||||
dest: "{{ cinny_tarball_path }}"
|
||||
url_username: "{{ cinny_tarball_url_username | default(omit, true) }}"
|
||||
url_password: "{{ cinny_tarball_url_password | default(omit, true) }}"
|
||||
mode: "0664"
|
||||
when: cinny_is_update
|
||||
|
||||
- name: Ensure old application files are gone
|
||||
ansible.builtin.file:
|
||||
path: "{{ cinny_dist_path }}"
|
||||
state: absent
|
||||
when: cinny_is_update
|
||||
|
||||
- name: Extract tarball to {{ cinny_source_path }}
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ cinny_tarball_path }}"
|
||||
dest: "{{ cinny_source_path }}"
|
||||
remote_src: true
|
||||
owner: "{{ cinny_host_uid }}"
|
||||
group: "{{ cinny_host_gid }}"
|
||||
mode: "u+rwX,g+rwX,o+rX"
|
||||
when: cinny_is_update
|
Reference in New Issue
Block a user