Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
babidi34 committed Apr 9, 2024
1 parent a9105a5 commit a17ed20
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
10 changes: 5 additions & 5 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ rclone_config_owner:
rclone_mkdir: true
rclone_mounts: []
# example :
#rclone_mounts:
# - name: test
# remote_path: "/test"
# local_path: "/mnt"
# auto_mount: true
# rclone_mounts:
# - name: test
# remote_path: "/test"
# local_path: "/mnt"
# auto_mount: true
8 changes: 2 additions & 6 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,5 @@
action: ansible.builtin.setup

- name: Reload and restart rclone-mount services
ansible.builtin.shell: |
systemctl daemon-reload
for service in /etc/systemd/system/rclone-mount@*.service; do
systemctl enable $(basename $service)
systemctl restart $(basename $service)
done
ansible.builtin.systemd:
daemon_reload: yes
4 changes: 2 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@
mode: 0600
register: setup_rclone_config

- name: mount rclone
- name: Mount rclone
ansible.builtin.include_tasks: mount.yml
when: rclone_mounts | length > 0
when: rclone_mounts | length > 0
23 changes: 21 additions & 2 deletions tasks/mount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
ansible.builtin.command:
cmd: "rclone mkdir '{{ item.remote_name }}':{{ item.remote_path }}"
loop: "{{ rclone_mounts }}"
when: rclone_mkdir
when: rclone_mkdir
register: rclone_mkdir_output
changed_when: rclone_mkdir_output.rc == 0

- name: Install fuse
ansible.builtin.package:
Expand All @@ -27,4 +29,21 @@
mode: '0644'
loop: "{{ rclone_mounts }}"
when: item.remote_path is defined and item.local_path is defined
notify: "Reload and restart rclone-mount services"
notify: "Reload and restart rclone-mount services"

- name: Find and manage rclone-mount services
tags: [always]
block:
- name: Find rclone-mount services
ansible.builtin.find:
paths: /etc/systemd/system
patterns: 'rclone-mount@*.service'
register: found_services

- name: Enable and restart rclone-mount services
ansible.builtin.systemd:
name: "{{ item.path | basename }}"
enabled: yes
state: restarted
loop: "{{ found_services.files }}"
notify: Reload and restart rclone-mount services

0 comments on commit a17ed20

Please sign in to comment.