Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to mount tasks & related docs #169

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ Note: This example assumes you have created the `rclone.service` systemd unit yo

This variable allows for the configuration of rclone mounts within your infrastructure. `rclone_mounts` should be a YAML list of objects, each including keys for `name`, `remote_name`, `remote_path`, `local_path`, `auto_mount`, and `extra_args`. This setup enables precise control over multiple mount points, their remote sources, and whether they should be automatically mounted.

If you use this variable, you must run this role as root using `become: true`.
The role will attempt to create all defined `remote_path`'s by default, **if** the `remote_path` is not simply `/`. You can disable this by setting `rclone_mkdir` to `false`.

If you use `rclone_mounts`, you must run this role as root using `become: true`.

#### Detailed example for `rclone_mounts`

Expand Down
10 changes: 9 additions & 1 deletion tasks/mount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
ansible.builtin.command:
cmd: "rclone mkdir '{{ item.remote_name }}':{{ item.remote_path }}"
loop: "{{ rclone_mounts }}"
when: rclone_mkdir
loop_control:
label: "{{ item.remote_name }}:{{ item.remote_path }}"
when:
- rclone_mkdir
- item.remote_path != '/'
register: rclone_mkdir_output
changed_when: rclone_mkdir_output.rc == 0

Expand All @@ -28,6 +32,8 @@
group: root
mode: '0644'
loop: "{{ rclone_mounts }}"
loop_control:
label: "{{ item.name }}"
when: item.remote_path is defined and item.local_path is defined
notify: "Reload and restart rclone-mount services"

Expand All @@ -46,4 +52,6 @@
enabled: yes
state: restarted
loop: "{{ found_services.files }}"
loop_control:
label: "{{ item.path | basename }}"
notify: Reload and restart rclone-mount services