1- hosts: localhost 2 vars: 3 git_install: '{{ lookup("file", lookup("env", "OUTPUT_DIR") + "/git_install.json") | from_json }}' 4 tasks: 5 - name: remove unwanted packages 6 package: 7 name: git 8 state: absent 9 when: git_install.changed 10 11 - name: remove auto-installed packages from FreeBSD 12 package: 13 name: git 14 state: absent 15 autoremove: yes 16 when: git_install.changed and ansible_distribution == "FreeBSD" 17