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

Ensure local mount path exists #168

Merged
merged 1 commit into from
Nov 16, 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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ Note: This example assumes you have created the `rclone.service` systemd unit yo

### `rclone_mounts: ""`

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.
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`. Optionally, you can also pass `local_path_mode` (defaults to `0755`), `local_path_owner`, and `local_path_group` (both default to `root`).

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`.

Expand All @@ -227,6 +229,9 @@ rclone_mounts:
remote_name: BackblazeLM
remote_path: "/my-app"
local_path: "/var/backups/my-app/"
local_path_mode: 0755
local_path_owner: root
local_path_group: root
auto_mount: true
extra_args: "--allow-other"
```
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,8 @@ rclone_mounts: []
# - name: test
# remote_path: "/test"
# local_path: "/mnt"
# local_path_mode: 0755
# local_path_owner: root
# local_path_group: root
# auto_mount: true
# extra_args: "--allow-other"
9 changes: 9 additions & 0 deletions tasks/mount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
register: rclone_mkdir_output
changed_when: rclone_mkdir_output.rc == 0

- name: Ensure local path exists
ansible.builtin.file:
path: "{{ item.local_path }}"
mode: "{{ item.local_path_mode | default('0755') }}"
owner: "{{ item.local_path_owner | default('root') }}"
group: "{{ item.local_path_group | default('root') }}"
state: directory
loop: "{{ rclone_mounts }}"

- name: Install fuse
ansible.builtin.package:
name: fuse
Expand Down