diff --git a/README.md b/README.md index 4122988..30f34ba 100644 --- a/README.md +++ b/README.md @@ -215,9 +215,10 @@ activated when there are no active network connections. This allows the git-annex assistant to be used when on trusted networks and when offline, but not when on untrusted networks. -If the `gitannex.stopped_on` variable is set to anything other than -`untrusted`, the NetworkManager dispatchers will not be installed, resulting in -the git-annex assistant service not being stopped on untrusted networks. +If the `gitannex.stop_on_untrusted` variable is set to anything other than +`True` or is not defined, the git-annex unit will not be added to the trusted +unit file, resulting in the git-annex assistant not being stopped on untrusted +networks. ## Known Issues diff --git a/group_vars/all b/group_vars/all index 1549a2b..a7237ff 100644 --- a/group_vars/all +++ b/group_vars/all @@ -84,7 +84,7 @@ tarsnapper: run_on: trusted gitannex: - stopped_on: untrusted + stop_on_untrusted: True bitlbee: run_on: trusted diff --git a/roles/git-annex/tasks/main.yml b/roles/git-annex/tasks/main.yml index 4b9e32f..8411635 100644 --- a/roles/git-annex/tasks/main.yml +++ b/roles/git-annex/tasks/main.yml @@ -9,8 +9,18 @@ service: name="git-annex@{{ user.name }}.service" enabled=yes state=started when: gitannex is defined +- name: Disable and stop git-annex assistant service + service: name="git-annex@{{ user.name }}.service" enabled=no state=stopped + when: gitannex is not defined + - 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.stopped_on == "untrusted" + when: gitannex is defined and 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