add rclone role

This commit is contained in:
2025-09-23 22:25:53 +01:00
parent 60b3b58c55
commit 5d01ce166b
5 changed files with 133 additions and 0 deletions

25
roles/rclone/README.md Normal file
View File

@@ -0,0 +1,25 @@
# vars example
```yaml
rclone_configs:
- path: "/etc/myLimbo/rclone-s3-storage-lan.conf"
content: |
[s3-storage-lan]
type=s3
provider=SeaweedFS
endpoint=http://nas.lan:8334
access_key_id=?????
secret_access_key=-????
use_multipart_uploads=true
force_path_style=true
env_auth=false
rclone_mounts:
- source: s3-storage-lan:storage.iso
target: /mnt/s3-storage-lan/cache
config_file: "/etc/myLimbo/rclone-s3-storage-lan.conf"
- source: s3-storage-lan:storage.lxc_images
target: /mnt/s3-storage-lan/lxc
config_file: "/etc/myLimbo/rclone-s3-storage-lan.conf"
```

View File

View File

@@ -0,0 +1,53 @@
galaxy_info:
author: mf
description: rclone
company: limbosolutions
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies:
# - role: myInfra.journald
# - role: myInfra.telegraf
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@@ -0,0 +1,55 @@
- name: Install the latest version
become: true
ansible.builtin.package:
name:
- rclone
state: latest
- name: Setup config files
ansible.builtin.blockinfile:
path: "{{ item.path }}"
block: "{{ item.content }}"
create: true
backup: true
with_items: "{{ rclone_configs }}"
- name: Creates directory
ansible.builtin.file:
path: "{{ item.target }}"
state: directory
with_items: "{{ rclone_mounts }}"
# needs rework
# - ansible.builtin.lineinfile:
# path: /etc/fstab
# regexp: "#added by ansible role myLimbo.rclone - {{ item.source }}"
# state: present
# backup: true
# line: |
# #added by ansible role myLimbo.rclone - {{ item.source }}
# with_items: "{{ mounts }}"
# - ansible.builtin.lineinfile:
# path: /etc/fstab
# insertafter: "#added by ansible role myLimbo.rclone - {{ item.source }}"
# regexp: "^{{ item.source}} {{ item.target }} rclone"
# line: |
# {{ item.source}} {{ item.target }} rclone rw,nofail,_netdev,x-systemd.automount,args2env,vfs_cache_mode=off,config={{item.config_file}} 0 0
# with_items: "{{ mounts }}"
- name: Create a symbolic link
ansible.builtin.file:
src: /usr/bin/rclone
dest: /sbin/mount.rclone
owner: root
group: root
state: link
- name: reload systemd
ansible.builtin.command: systemctl daemon-reload
- name: reload systemd
ansible.builtin.command: mount -a

View File