diff --git a/tasks/install.yml b/tasks/install.yml index 18ed157..a8ef9ba 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -43,6 +43,12 @@ become_user: "{{ jellyfin_user }}" - block: + - name: Write current version to custom fact + template: + src: etc/ansible/facts.d/jellyfin.fact.j2 + dest: /etc/ansible/facts.d/jellyfin.fact + when: jellyfin_version is version(jellyfin_current_version, ">") or jellyfin_current_version is version('0.0.0', "=") + - name: Copy systemd unit file template: src: "etc/systemd/system/jellyfin.service.j2" diff --git a/tasks/prepare.yml b/tasks/prepare.yml index b4365f6..5ea0c2e 100644 --- a/tasks/prepare.yml +++ b/tasks/prepare.yml @@ -1,5 +1,17 @@ --- - block: + - name: Create local facts dir + file: + path: /etc/ansible/facts.d + state: directory + + - name: Set current jellyfin version + set_fact: + jellyfin_current_version: "{{ (ansible_local.jellyfin | default (dict(version='0.0.0')))['version'] }}" + + - debug: + msg: Current version is '{{ jellyfin_current_version }}' + - name: Create group '{{ jellyfin_group }}' group: name: "{{ jellyfin_group }}" diff --git a/templates/etc/ansible/facts.d/openhab.fact.j2 b/templates/etc/ansible/facts.d/openhab.fact.j2 new file mode 100644 index 0000000..f45c803 --- /dev/null +++ b/templates/etc/ansible/facts.d/openhab.fact.j2 @@ -0,0 +1,4 @@ +{ + "comment" : "{{ ansible_managed }}", + "version" : "{{ jellyfin_version }}" +}