make custom fact idempotent

This commit is contained in:
Robert Kaussow 2018-07-08 23:43:57 +02:00
parent a6ec36a870
commit aca67c8151

View File

@ -1,4 +1,8 @@
---
- name: Set current unifi version
set_fact:
unifi_current_version: "{{ ansible_local.unifi.version | default ("0.0.0")}}"
- block:
- name: Install requirements
package:
@ -51,7 +55,7 @@
state: absent
become: True
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
file:
@ -82,5 +86,5 @@
template:
src: etc/ansible/fact.d/unifi.json.j2
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