do not perform any git-annex tasks if gitannex variable is not defined

This commit is contained in:
Pig Monkey 2016-08-18 20:46:24 -07:00
parent 7069621fdd
commit 6fe54654b3
2 changed files with 4 additions and 9 deletions

View file

@ -35,7 +35,7 @@
- { role: macbook, tags: ['macbook'], when: "'MacBook' in ansible_product_name" }
- { role: screensaver, tags: ['screensaver'] }
- { role: chat, tags: ['chat'] }
- { role: git-annex, tags: ['git-annex'] }
- { role: git-annex, tags: ['git-annex'], when: "gitannex is defined" }
- { role: ledger, tags: ['ledger'] }
- { role: mail, tags: ['mail'] }
- { role: cups, tags: ['cups'] }

View file

@ -14,26 +14,21 @@
- name: Enable and start git-annex assistant service
service: name="git-annex@{{ user.name }}.service" enabled=yes state=started
when: gitannex is defined and autostart.stat is defined and autostart.stat.size > 0
- name: Disable and stop git-annex assistant service
service: name="git-annex@{{ user.name }}.service" enabled=no state=stopped
when: gitannex is not defined
when: autostart.stat is defined and autostart.stat.size > 0
- name: Add git-annex to trusted unit list
lineinfile: dest=/usr/local/etc/trusted_units
state=present
line="git-annex@{{ user.name }}.service,allow_offline"
when: gitannex is defined and gitannex.stop_on_untrusted is defined and gitannex.stop_on_untrusted == True
when: gitannex.stop_on_untrusted is defined and gitannex.stop_on_untrusted == True
- name: Remove git-annex from trusted unit list
lineinfile: dest=/usr/local/etc/trusted_units
state=absent
line="git-annex@{{ user.name }}.service,allow_offline"
when: gitannex is not defined or gitannex.stop_on_untrusted is not defined or gitannex.stop_on_untrusted != True
when: gitannex.stop_on_untrusted is not defined or gitannex.stop_on_untrusted != True
- name: Increase the amount of inotify watchers
copy: src=99-max_watches.conf dest=/etc/sysctl.d/99-max_watches.conf
when: gitannex is defined
notify:
- reload sysctl