make custom fact idempotent
This commit is contained in:
parent
a6ec36a870
commit
aca67c8151
@ -1,4 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
- name: Set current unifi version
|
||||||
|
set_fact:
|
||||||
|
unifi_current_version: "{{ ansible_local.unifi.version | default ("0.0.0")}}"
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
package:
|
package:
|
||||||
@ -51,7 +55,7 @@
|
|||||||
state: absent
|
state: absent
|
||||||
become: True
|
become: True
|
||||||
become_user: "{{ unifi_user }}"
|
become_user: "{{ unifi_user }}"
|
||||||
when: ansible_local.unifi.version is is version_compare(unifi_version, ">")
|
when: unifi_current_version is version_compare(unifi_version, ">")
|
||||||
|
|
||||||
- name: Create symlink for latest version
|
- name: Create symlink for latest version
|
||||||
file:
|
file:
|
||||||
@ -82,5 +86,5 @@
|
|||||||
template:
|
template:
|
||||||
src: etc/ansible/fact.d/unifi.json.j2
|
src: etc/ansible/fact.d/unifi.json.j2
|
||||||
dest: /etc/ansible/fact.d/unifi.json
|
dest: /etc/ansible/fact.d/unifi.json
|
||||||
when: ansible_local.unifi.version is is version_compare(unifi_version, ">")
|
when: unifi_current_version is version_compare(unifi_version, ">")
|
||||||
become: True
|
become: True
|
||||||
|
Loading…
Reference in New Issue
Block a user