Code Monkey home page Code Monkey logo

ansible-rclone's Introduction

ansible-rclone

AKA ansible_rclone and formerly rclone

GitHub Workflow Status

GitHub Open Issues GitHub Stars GitHub Forks

Ansible Role Ansible Role Downloads

Description

An Ansible role to install rclone

Please note that this role installs rclone from the upstream repository and not from the OS repositories!

Usage

  1. Clone this repo into your local roles-directory or install via ansible-galaxy install stefangweichinger.ansible_rclone
  2. Add role to the hosts you want rclone installed to.

Supported Platforms

The build tests run on a selected set of distros:

  • CentOS 8
  • Debian 9,10
  • Fedora 32,33,34
  • Ubuntu 1804,2004
  • Ubuntu derivated distros: Linux Mint, Pop!_OS

Some older releases also work with this role, but I decided to remove some of them from galaxy_info. PRs welcome, but we can't test on every platform.

Role Variables

Available variables are listed below, along with default values (see defaults/main.yml):

install_manpages: "true"

This can be used to toggle the installation of manpages.

rclone_arch: "amd64"

This variable chooses the target architecture (for example 'amd64').

rclone_version: "stable"

The version of rclone to install. rclone_version can be set to a specific version number, or "stable", or "beta" to install the latest beta version.

rclone_version: ""

rclone_version: "1.50.2"

rclone_version: "beta"

rclone_config_location: "/root/.config/rclone/rclone.conf"

The location to install the rclone config file if you provide rclone_configs

rclone_configs: ""

This variable allows for predefined remote configs to be loaded. rclone_configs must be a YAML list with a name variable and a properties variable which is another list of arbitrary key value pairs. See the example below which would configure a Google Drive remote:

rclone_configs:
  - name: ExampleGoogleDriveRemote
    properties:
      type: drive
      client_id: 12345
      client_secret: 67890
      token: ' {"access_token":"","token_type":"","refresh_token":"","expiry":""}'

Note that the space after the single quote ' for token is intentional in order to force this into a string. Otherwise, it will be interpreted as an object and have its double quotes be converted to single quotes within the config file which rclone cannot parse correctly.

rclone_configs detailed example

The rclone_configs variable is used to recreate the rclone.conf file. This config file stores the rclone remotes that have been defined and are usable. This is an alternative to simply copying a stored rclone.conf file directly.

The rclone_configs simply takes a list of YAML objects which must have a name which will map to the name of the remote, and a properties which can be any key, value pairs which will map to the variables stored under that remote. These should be the ones expected by the rclone.conf file for the remote type you're configuring.

For example, to recreate a standard encrypted Google Drive mount setup, the rclone.conf will look similar to below, assuming you have your encypted files stored in the "media" folder on Google Drive:

[google-drive]
type = drive
client_id = <CLIENT_ID>
client_secret = <CLIENT_SECRET>
token = {"access_token":"<ACCESS_TOKEN>","token_type":"Bearer","refresh_token":"<REFRESH_TOKEN>","expiry":"<DATETIME>"}
root_folder_id = <ROOT_FOLDER_ID>

[encrypted-media]
type = crypt
remote = google-drive:media
filename_encryption = standard
password = <PASSWORD>
password2 = <PASSWORD2>

To enable ansible-rclone to recreate that config file, you can provide an rclone_configs variable as follows. Note that this should always be encrypted if stored publicly as it gives access to your remotes:

rclone_configs:
  - name: google-drive
    properties:
      type: drive
      client_id: <CLIENT_ID>
      client_secret: <CLIENT_SECRET>
      token: ' {"access_token":"<ACCESS_TOKEN>","token_type":"Bearer","refresh_token":"<REFRESH_TOKEN>","expiry":"<DATETIME>"}'
      root_folder_id = <ROOT_FOLDER_ID>
  - name: encrypted-media
    properties:
      type: crypt
      remote: google-drive:media
      filename_encryption: standard
      password: <PASSWORD>
      password2: <PASSWORD2>

Dependencies

None.

Example Playbook

- hosts: rclone-hosts
  roles:
    - rclone

Troubleshooting

Module Name Issue:

[WARNING]: - stefangweichinger.rclone was NOT installed successfully: - sorry, stefangweichinger.rclone was not found on https://galaxy.ansible.com/api/

Note that this module has undergone a name change. It was previously known as stefangweichinger.rclone, however Galaxy changed it's naming methods. We are working on a change that will put move it back to this name for simplicity. Ansible Galaxy substitutes - to _ and used to strip a prefix or ansible. For more information, see the this issue.

Molecule Testing

The tests of this ansible role use molecule

(disabled) Travis CI

At first I used Travis CI, see the logs at https://travis-ci.org/github/stefangweichinger/ansible-rclone

Build Status

(current) CI with GitHub Actions

In November 2020 I switched over to running the CI pipeline within Github Actions:

https://github.com/stefangweichinger/ansible-rclone/actions

GitHub Workflow Status

This, like this whole repo, is a work in progress.

ansible-rclone's People

Contributors

anordin95 avatar axsuul avatar bradym avatar chrisorlando avatar clashthebunny avatar danrabinowitz avatar emilstahl avatar jackodsteel avatar kmarekspartz avatar lgnap avatar lonix avatar mjmayer avatar nfaction avatar puchrojo avatar stefangweichinger avatar tangel0v avatar theenglishway avatar triwats avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.