Git Product home page Git Product logo

ansible-rclone's People

Contributors

alfajorcito avatar anordin95 avatar apollo3zehn avatar axsuul avatar babidi34 avatar bradym avatar chrisorlando avatar clashthebunny avatar danrabinowitz avatar emilstahl avatar jackodsteel avatar kmarekspartz avatar lgnap avatar linckez avatar lonix avatar mjmayer avatar nfaction avatar notetiene avatar puchrojo avatar stefangweichinger avatar tangel0v avatar theenglishway avatar theonewizard avatar tigattack avatar triwats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ansible-rclone's Issues

Get rclone stable version step fails with permission denied error

First of all, thanks for sharing this ansible role!

I'm using it to install rclone on Ubuntu 20.04.1 and getting the following error:

TASK [stefangweichinger.ansible_rclone : Get rclone stable version 1.53.3] **************************************************************
fatal: [deadshot]: FAILED! => {
    "changed": true,
    "dest": "/tmp/rclone_setup",
    "extract_results": {
        "cmd": [
            "/usr/bin/unzip",
            "-o",
            "/home/bradym/.ansible/tmp/ansible-tmp-1609646032.6070466-1432-39565428595664/rclone-v1.53.3-linux-amd64h1g4bw0w.zip",
            "-d",
            "/tmp/rclone_setup"
        ],
        "err": "",
        "out": "Archive:  /home/bradym/.ansible/tmp/ansible-tmp-1609646032.6070466-1432-39565428595664/rclone-v1.53.3-linux-amd64h1g4bw0w.zip\n   creating: /tmp/rclone_setup/rclone-v1.53.3-linux-amd64/\n  inflating: /tmp/rclone_setup/rclone-v1.53.3-linux-amd64/README.html  \n  inflating: /tmp/rclone_setup/rclone-v1.53.3-linux-amd64/rclone.1  \n  inflating: /tmp/rclone_setup/rclone-v1.53.3-linux-amd64/rclone  \n  inflating: /tmp/rclone_setup/rclone-v1.53.3-linux-amd64/README.txt  \n  inflating: /tmp/rclone_setup/rclone-v1.53.3-linux-amd64/git-log.txt  \n",
        "rc": 0
    },
    "gid": 1001,
    "group": "bradym",
    "handler": "ZipArchive",
    "mode": "0775",
    "owner": "bradym",
    "size": 4096,
    "src": "/home/bradym/.ansible/tmp/ansible-tmp-1609646032.6070466-1432-39565428595664/rclone-v1.53.3-linux-amd64h1g4bw0w.zip",
    "state": "directory",
    "uid": 1001
}

MSG:

Unexpected error when accessing exploded file: [Errno 13] Permission denied: b'/tmp/rclone_setup/rclone-v1.53.3-linux-amd64/README.html'

Looks like this is happening because in the stable (and beta) task the following is present:

- name: Get rclone stable version {{ rclone_version }}
  unarchive:
    src: https://downloads.rclone.org/v{{ rclone_version }}/rclone-v{{ rclone_version }}-linux-{{ rclone_arch }}.zip
    dest: "{{ rclone_setup_tmp_dir }}"
    remote_src: true
    mode: 0644
    creates: "{{ rclone_setup_tmp_dir }}/rclone-v{{ rclone_version }}-linux-{{ rclone_arch }}"

I believe the issue is that the folder is being created with 0644 permissions, which doesn't allow the owner of the folder to enter the folder. I've confirmed that setting mode to 0744 fixes the error, I'll submit a pull request.

macOS support

Thank you so much for this library!

I know macOS, we can install by Homebrew through Ansible. However, it does not support many custom features like config.
It would be great to support macOS in future too, thanks!

Just open this ticket to see if any other people have same request by voting up ๐Ÿ˜ƒ

Galaxy role is out of date

PR #13 was merged here 4 months ago, adding support for the beta releases, but Galaxy hasn't been triggered to import the new version of the role.

Please tag a GitHub release and import into Galaxy.

Though if you want, it looks like Travis-CI integration webhooks are how Galaxy does automatic updates here.

rclone_version: "stable" doesn't seem to work?

Following the directions in the repository, I tried setting:

---
- hosts: backup
  become: true

  vars:
    rclone_arch: "arm64"
    rclone_version: "stable"

  roles:
    - stefangweichinger.ansible_rclone

But I get the following error:

TASK [stefangweichinger.ansible_rclone : Get rclone stable version stable] *********************************************
fatal: [backup.geerli.net]: FAILED! => {"changed": false, "msg": "Failure downloading https://downloads.rclone.org/vstable/rclone-vstable-linux-arm64.zip, HTTP Error 404: Not Found"}

PLAY RECAP *************************************************************************************************************
backup.geerli.net          : ok=10   changed=3    unreachable=0    failed=1    skipped=6    rescued=0    ignored=0  

installation from OS repositories

So far the role installs from upstream repos only and passes the OS package management.
This might be problematic in some cases.

I think of adding another installation "mode": a toggle like os_packages with default "false", this would use the standard OS package manager to install rclone via apt or dnf or so.

As far as I see this leads to some new structure. Maybe use blocks for this, maybe sub-task-files like we do right now with stable and beta installation. Many of the tasks executed now wouldn't be needed with an installation with os_packages: True.

PRs welcome, as always.

Support for Ubuntu derivated distributions

Hi Stephan

I have been using your role for last year and it's great: simple and efficient, but I have upgraded my laptop from PopOS 19.10 to PopOS 20.04 and I have detected it has stopped working.

The problem is located in the data received by Ansible in ansible_distribution vars. PopOS and other Ubuntu derivated distros sometimes modify the content of /etc/os-release. For example: the content of my ansible_distribution is "Pop!_OS" therefore task "Gather OS specific variables" fails with the following error:

"msg": "No file was found when using first_found. Use errors='ignore' to allow this task to be skipped if no files are found

I want to change this behaviour to use ansible_distribution_release instead of using ansible_distribution, covering all Linux distrubutions based in Ubuntu.

Will you accept a PR with this feature? I'll add support for Ubuntu 20.04 too.

Thank you very much

Permission issues when using ansible user is non privileged

When executing the role with non privilege user, several tasks fails because they lack privilege escalation.

The offending tasks are:

- name: Create directory for ansible custom facts
  ansible.builtin.file:
    state: directory
    recurse: true
    path: /etc/ansible/facts.d

- name: Create facts file from template
  ansible.builtin.template:
    src: 'etc/ansible/facts.d/rclone.fact.j2'
    dest: /etc/ansible/facts.d/rclone.fact
    mode: '0755'
  register: rclone__register_facts

When executing the role, I get:

TASK [stefangweichinger.ansible_rclone : Create directory for ansible custom facts] ***********************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "There was an issue creating /etc/ansible/facts.d as requested: [Errno 13] Permission denied: b'/etc/ansible/facts.d'", "path": "/etc/ansible/facts.d"}

The solution would be to add become: true in both tasks.

rclone_configs breaks when properties have json objects

I have this in one of my playbooks:

  vars:
    rclone_arch: "arm"
    rclone_config_location: "/home/pi/.config/rclone/rclone.conf"
    rclone_configs:
      - name: pCloud
        properties:
          type: pcloud
          token: {"access_token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}

using the playbook works, but this is what tho rclone config file looks like afterwards:

[pCloud]
type = pcloud
token = {'access_token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'token_type': 'bearer', 'expiry': '0001-01-01T00:00Z'}

This results in an error message when trying to ls the remote, because rclone can't read the token. Ansible seems to have parsed the token to an object and serializes it later with single quotes instead of double quotes. I guess the fix would just be to make Ansible interpret the variables as strings, I don't know Ansible though, so I don't know if that's possible.

My workaround is to just put single quotes around the token variable like this:

token: '{"access_token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","token_type":"bearer","expiry":"0001-01-01T00:00:00Z"}'

This seems to work, Ansible does not touch the formatting anymore and rclone can connect to the remote afterwards. If fixing this is not possible due to how Ansible reads config files, it would be nice if you could add single quotes to the variables in the README.md, because right now your example will break.

Config folder should be created

This folder may not exist and the role should make sure it exists:

FAILED! => {"changed": false, "checksum": "8dfd770af55b0c932bd63e7d26f01b93e6faf9f2", "msg": "Destination directory /root/.config/rclone does not exist"}

E.g. (untested)

- name: Create rclone config directory
  file: path='{{ rclone_config_location }}' state=directory mode=0700

- name: Set up rclone config
  template:
    src: rclone.conf.j2
    dest: '{{ rclone_config_location }}'
  when: rclone_configs is defined

"Perform the install steps" task fails with Jinja2 < 2.11

Hi !

I'm not sure it's an actual issue but I've just hit an error while trying to run your role in the kind of very simple playbook that you exemplify in the readme :

- hosts: all
  roles:
    - rclone

The error message is :

"The conditional check '(ansible_facts['ansible_local']['rclone']['installed'] is not true) or (ansible_facts['ansible_local']['rclone']['installed_version'] != rclone_version)' failed. The error was: template error while templating string: no test named 'true'. String: {% if (ansible_facts['ansible_local']['rclone']['installed'] is not true) or (ansible_facts['ansible_local']['rclone']['installed_version'] != rclone_version) %} True {% else %} False {% endif %}"

The test to blame is (ansible_facts['ansible_local']['rclone']['installed'] is not true) or (ansible_facts['ansible_local']['rclone']['installed_version'] != rclone_version) in main.yml :

when: (ansible_facts['ansible_local']['rclone']['installed'] is not true) or (ansible_facts['ansible_local']['rclone']['installed_version'] != rclone_version)

(... which was added in the latest commit)

I installed ansible ages ago via a pip install --user, and my installed version is 2.9.9, so I suspected a dependency problem.. and playing around a bit within a virtualenv, I realized the culprit was not ansible but Jinja2.

So here's the result of my fiddling around :

  • latest ansible-rclone + ansible >= 2.9.9 + Jinja2 >= 2.11 : โœ”๏ธ
  • latest ansible-rclone + ansible >= 2.9.9 + Jinja2 < 2.11 : ๐Ÿ›‘
  • previous version of ansible-rclone + ansible >= 2.9.9 + Jinja2 >= 2.10 : โœ”๏ธ

(I guess the result will be the same with any version of ansible but I didn't bother to check)

The true test was added in Jinja2 version 2.11 indeed : https://jinja.palletsprojects.com/en/2.11.x/changelog/#version-2-11-0

Add new boolean, false, true, integer and float tests.

Again, I'm not sure how much of an issue it is considering Jinja2 version 2.11 is already more than one year old, and whether you can express that kind of dependency within ansible-galaxy, but I guess one might hit this issue when using old versions of ansible..

Cheers !

How to check logs?

At first I had problems with detection what happend, when I put wrong client_id. As I understand it couldn't register on Google Drive and by this reason wasn't able to create rclone.conf. But I had on ansible log just info that rclone.conf wasn't found. It was not very easy task to understand that it is not connected with permissions like in this issue etc.

At second, when it is not connected by any reasons via rclone_mounts I see that command was successful. If I use pure rclone I can use --log-file like this:

sudo rclone mount GoogleDriveRemote:directory /directory/ --allow-non-empty --vfs-cache-mode writes --log-level INFO --log-file /home/user/GoogleDriveRemote.log

Ansible play fails due to wrong version

Hello, our reoccurring jobs started failing with this error


TASK [stefangweichinger.ansible_rclone : Do stable install] ********************
included: /tmp/awx_17505_4r2_w45k/requirements_roles/stefangweichinger.ansible_rclone/tasks/stable.yml for localhost

TASK [stefangweichinger.ansible_rclone : Check latest stable rclone version number] ***
ok: [localhost] => {"accept_ranges": "bytes", "changed": false, "connection": "close", "content": "rclone v1.53.3\n", "content_length": "15", "content_type": "text/plain; charset=utf-8", "cookies": {}, "cookies_string": "", "date": "Tue, 24 Nov 2020 20:17:29 GMT", "elapsed": 0, "etag": "\"qk20dif\"", "last_modified": "Thu, 19 Nov 2020 17:24:54 GMT", "msg": "OK (15 bytes)", "redirected": false, "server": "Caddy", "status": 200, "url": "https://downloads.rclone.org/version.txt"}

TASK [stefangweichinger.ansible_rclone : Set variable to latest stable version number] ***
ok: [localhost] => {"ansible_facts": {"rclone_version": "1.53.3"}, "changed": false}

TASK [stefangweichinger.ansible_rclone : Get rclone stable version 1.53.3] *****
skipping: [localhost] => {"changed": false, "msg": "skipped, since /tmp/rclone_setup/rclone-v1.53.3-linux-amd64 exists"}

TASK [stefangweichinger.ansible_rclone : Get list of files extracted from the rclone archive] ***
ok: [localhost] => {"changed": false, "examined": 3, "files": [{"atime": 1599987430.0, "ctime": 1601417184.3817184, "dev": 44, "gid": 0, "gr_name": "root", "inode": 101401429, "isblk": false, "ischr": false, "isdir": true, "isfifo": false, "isgid": false, "islnk": false, "isreg": false, "issock": false, "isuid": false, "mode": "0755", "mtime": 1599987430.0, "nlink": 2, "path": "/tmp/rclone_setup/rclone-v1.53.1-linux-amd64", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 92, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": true, "xoth": true, "xusr": true}, {"atime": 1603725122.0, "ctime": 1603727445.8468351, "dev": 44, "gid": 0, "gr_name": "root", "inode": 721795, "isblk": false, "ischr": false, "isdir": true, "isfifo": false, "isgid": false, "islnk": false, "isreg": false, "issock": false, "isuid": false, "mode": "0755", "mtime": 1603725122.0, "nlink": 2, "path": "/tmp/rclone_setup/rclone-v1.53.2-linux-amd64", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 92, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": true, "xoth": true, "xusr": true}, {"atime": 1605806149.0, "ctime": 1605808263.238737, "dev": 44, "gid": 0, "gr_name": "root", "inode": 67936871, "isblk": false, "ischr": false, "isdir": true, "isfifo": false, "isgid": false, "islnk": false, "isreg": false, "issock": false, "isuid": false, "mode": "0644", "mtime": 1605806149.0, "nlink": 2, "path": "/tmp/rclone_setup/rclone-v1.53.3-linux-amd64", "pw_name": "root", "rgrp": true, "roth": true, "rusr": true, "size": 92, "uid": 0, "wgrp": false, "woth": false, "wusr": true, "xgrp": false, "xoth": false, "xusr": false}], "matched": 3, "msg": ""}

TASK [stefangweichinger.ansible_rclone : Validate the version in the archive matches the expected version (1.53.3)] ***
fatal: [localhost]: FAILED! => {"changed": false, "msg": "\"The version of rclone (rclone-v1.53.1-linux-amd64) in the archive does not match the expected version (1.53.3)\"\n"}

PLAY RECAP *********************************************************************
localhost                  : ok=9    changed=0    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0   

I see that there are similar issues recently but this seems different.

Fails when Rclone is already latest version

It appears to have failed for me when there is no new version of Rclone.

TASK [stefangweichinger.ansible_rclone : Do stable install] *************************************************************************************************************************
Saturday 24 October 2020  18:17:02 +0000 (0:00:00.264)       0:05:37.275 ****** 
included: /home/ansible/.ansible/roles/stefangweichinger.ansible_rclone/tasks/stable.yml for RCLONE_HOST

TASK [stefangweichinger.ansible_rclone : Check latest stable rclone version number] *************************************************************************************************
Saturday 24 October 2020  18:17:02 +0000 (0:00:00.227)       0:05:37.503 ****** 
ok: [RCLONE_HOST]

TASK [stefangweichinger.ansible_rclone : Set variable to latest stable version number] **********************************************************************************************
Saturday 24 October 2020  18:17:04 +0000 (0:00:01.543)       0:05:39.046 ****** 
ok: [RCLONE_HOST]

TASK [stefangweichinger.ansible_rclone : Get rclone stable version 1.53.1] **********************************************************************************************************
Saturday 24 October 2020  18:17:04 +0000 (0:00:00.240)       0:05:39.287 ****** 
skipping: [RCLONE_HOST]

TASK [stefangweichinger.ansible_rclone : Do beta install] ***************************************************************************************************************************
Saturday 24 October 2020  18:17:04 +0000 (0:00:00.154)       0:05:39.441 ****** 
skipping: [RCLONE_HOST]

TASK [stefangweichinger.ansible_rclone : Copy rclone binary] ************************************************************************************************************************
Saturday 24 October 2020  18:17:04 +0000 (0:00:00.062)       0:05:39.504 ****** 
fatal: [RCLONE_HOST]: FAILED! => {"changed": false, "msg": "Source /tmp/rclone_setup/rclone-v1.53.1-linux-amd64/rclone not found"}

Rclone config location

I am trying to add Rclone config during installation. Here is what I found:

I installed Rclone by

- name: Install Rclone
  hosts: hm-ubuntu
  roles:
    - role: stefangweichinger.ansible_rclone
      vars:
        rclone_configs:
          - name: hm-s3
            properties:
              type: s3
              provider: AWS
              access_key_id: xxx
              secret_access_key: xxx
              region: us-west-2
              storage_class: STANDARD

However, after installing, Rclone cannot find the config I added. Rclone expects to read the config at the location ~/.config/rclone/rclone.conf, while ansible-rclone installed the config file at /root/.config/rclone/rclone.conf.

parallels@ubuntu-linux-22-04-desktop:/usr/bin$ which rclone
/usr/local/bin/rclone

parallels@ubuntu-linux-22-04-desktop:/usr/bin$ ls -l /usr/local/bin/rclone
-rwxr-xr-x 1 root root 48037888 Jul 17 06:48 /usr/local/bin/rclone

parallels@ubuntu-linux-22-04-desktop:/usr/bin$ rclone config file
Configuration file doesn't exist, but rclone will use this path:
/home/parallels/.config/rclone/rclone.conf

parallels@ubuntu-linux-22-04-desktop:/usr/bin$ rclone config
2023/08/11 15:01:34 NOTICE: Config file "/home/parallels/.config/rclone/rclone.conf" not found - using defaults
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> 
parallels@ubuntu-linux-22-04-desktop:/usr/bin$ sudo cat /root/.config/rclone/rclone.conf
[sudo] password for parallels: 
[hm-s3]
type = s3
provider = AWS
access_key_id = xxx
secret_access_key = xxx
region = us-west-2
storage_class = STANDARD

To make it work, I need further add:

        rclone_config_location: "{{ ansible_env.HOME }}/.config/rclone/rclone.conf"
        rclone_config_owner:
          OWNER: "{{ ansible_env.USER }}"
          GROUP: "{{ ansible_env.USER }}"

I am wondering should we use ~/.config/rclone/rclone.conf as default location and set non-root user for the config file?
Or it is just be design maybe make it easy to share between multiple users? Thanks! ๐Ÿ˜ƒ

Molecule seems an issue.

I noticed you are also experiencing issues with Molecule and the required collections in prepare.yml and verify.yml.

I have not found a solution for this issue... I think it's a Molecule issue really, but a workaround may help.

Let me know if you want to work together to find a solution. (mail: [email protected])

Regards,

Robert.

Config file permissions seem too lenient

Yet another much more important issue that comes up while reading the code following issue #84

- name: Set up rclone config
  template:
    src: rclone.conf.j2
    dest: '{{ rclone_config_location }}'
    mode: 0644
  when: rclone_configs is defined

It seems to me like the permissions are way off, and should instead be 0600..

This is what the rclone.conf file permissions look like when you go through the rclone config interactive process on a brand new installation :

root@debian-server:~# ls -l /root/.config/rclone/
total 4
-rw------- 1 root root 21 Mar 21 16:37 rclone.conf

I'm almost surprised rclone does not issue a warning or even an error when that file is readable by anyone else than the user, since it holds some pretty interesting secrets..

Role name has changed

Hey, thanks for the role first and foremost, and the improvements over the last few years!

I've tried to run a playbook today that has this as a dependancy, however it is giving me a 404 on the role, which seems consistent.

Error:

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

Stated link within the README specifies this url, however this does not seem to work either.

I believe this is caused because it has been changed on within the Ansible Galaxy Metadata - is there a sane reason to do this? I do not mind refactoring, just seems to be a bit inconsistent.

Thanks!

semantic versioning

I understand the point of doing that, but I still don't know how to properly use commitizen ... the repository still isn't fully commitizen-friendly. Help would be appreciated here.

Originally posted by @stefangweichinger in #143 (comment)

Add support for beta version

One of the common requests when submitting a bug report to rclone is to install the latest beta.

The latest beta for rclone can be found at https://beta.rclone.org/rclone-beta-latest-linux-amd64.zip , however when this file is unarchived, the directory it creates is in the format of {Version Tag}-{Commit Number}-g{Git Commit Hash}. In your playbook, you assume that rclone will be extracted to the path '/tmp/rclone_setup/rclone-v{{ rclone_version }}-linux-amd64'.

I see two ways to work around this. We could keep your existing code and put it in a block that runs when rclone_version != "beta". Then add a new block for the beta version that includes some logic to find out the name of the directory that is created in the unarchive step. Alternatively, we could discard the creates option and determine the folder created in the unarchive step. Then use the path of the folder created in the unarchive step in the rest of the playbook.

Do you have a preferred solution or any other ideas? I can start working on a pull request once I have your input.

Config file is not updated when rclone_version matches the one already installed

As the title says.. The config file is never updated once rclone has been installed on the remote machine.

I guess it relates to issue #80 and the fix made in #82, that conditions the execution of install.yml (which contains the installation of the configuration) to the absence of a rclone whose version matches the specified rclone_version.

It's certainly an improvement that the install process does not run on each role execution, but I would say the rclone_configs is much more likely to change.. Maybe just splitting install.yml into a install-bin.yml and install-config.yml (which would be executed every time) would do the trick ?

errors when installing on jessie

I got errors using this as-is on a fresh install of debian jessie.

I needed to change the man path to /usr/share/man/man1 and man_group to "root" instead of "staff".

Config directory mode

There is no reason to set the config directory to 700. When installing in a very common location like /etc/rclone.conf, the role hoses the mode of the /etc directory and breaks a lot of stuff. 755 is a perfectly reasonable mode for a config directory as long as the file is set to 600.

Check run fails

Dry run fails:

$ ansible-playbook -l testhost -t rclone -C site.yml
...
TASK [stefangweichinger.ansible_rclone : Get rclone stable version 1.63.1] ************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NoneType: None
fatal: [testhost]: FAILED! => {"changed": false, "msg": "dest '/tmp/rclone_setup' must be an existing dir"}

New to ansible, help me with my YML?

Hi there,
New to ansible.
I got rclone installing fine.
However I am trying to configure my gdrive remote

My YML is as follows:

- name: rClone Google Drive installer & configurator
  hosts: gdrive
  become: true
  roles:
    - rclone
      rclone_config_location: /etc/ansible/playbooks/rclone.conf
      rclone_configs:
        - name: google
          properties:
            type: drive
            client_id: --REDACTED--
            client_secret: --REDACTED--
            scope: drive
            token: ' {"access_token":"--REDACTED--","token_type":"Bearer","refresh_token":"--REDACTED--","expiry":"--REDACTED--"}'
            team_drive: --REDACTED--

The problem I have is that when I run this, I get a YAML error syntax.

ERROR! Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to be in '/etc/ansible/playbooks/rclone.yml': line 7, column 29, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - rclone
      rclone_config_location: /etc/ansible/playbooks/rclone.conf
                            ^ here

I cannot figure out how to define the rclone_configs in the playbook, in a way that it accepts.

I was wondering if someone could help!

Thanks

remove travis CI, run molecule tests within GitHub Actions

In the branch ci_with_github_actions I started to set up a workflow to run the molecule tests within GitHub Actions instead of using Travis.

That looks promising already and also seems faster than the Travis tests.

I want to enhance these tests to run both stable and beta-installation scenarios (setting rclone_version), but I still have to figure out how to accomplish that in the most efficient way (where to place the loop or matrix).

If anyone wants to help here ...

fact-checking not correct with centos docker images

The fact checking script templates/etc/ansible/facts.d/rclone.fact.j2 (thankfully forked from @drybjed and the debops project) introduced with f281d85 does not return correct facts with the centos7 and centos8 instances, when tested via molecule.

After the first run the binary is installed and in place, then the fact-checker-script should report back ansible_local.rclone.installed = true. This in turn should lead to skipping a reinstallation: it's not needed anymore.

For centos the script returns ansible_local.rclone.installed = false to ansible/molecule, while when logged into the docker container and called from that shell it returns ansible_local.rclone.installed = true.

This doesn't actually break things, it just repeats the installation each time. So far no idea why.

For the other OS tests the new fact-checking-logic seems to work when I look at the molecule logs.

I asked @geerlingguy in geerlingguy/docker-centos7-ansible#13 for any thoughts, as he created the used docker images.

Automatical creation of token

Hi! As I see from your docs, I can not to define token property. I was sure that it should generate automatically

ansible-rclone/README.md

Lines 154 to 171 in 2aec630

```yml
- name: Install and configure rclone
ansible.builtin.include_role:
name: stefangweichinger.ansible_rclone
vars:
rclone_configs:
- name: ExampleGoogleDriveRemote
properties:
type: drive
client_id: 12345
client_secret: 67890
- name: Restart rclone
ansible.builtin.systemd:
name: rclone.service
state: restarted
when: setup_rclone_config.changed
```

But on practice it doesn't with error

drive: failed when making oauth client: failed to create oauth client: empty token found - please run \"rclone config reconnect GoogleDriveRemote:\""

And it becomes to work after I generated token via rclone config reconnect GoogleDriveRemote:\ in web brouser. But it has dedicated expiry time that can be a problem.

So, how do you recommend me to work?

Can't install specific version of rclone

The README.me indicates that the variable rclone_version, is not set by default, but can be defined as stable, beta or a specific version. But the logic in tasks/main.yml don't support the specific version option.

- name: Do stable install
  include_tasks: stable.yml
  when:
    - rclone_version is undefined or
      rclone_version == 'stable' or
      rclone_version != 'beta'

- name: Do beta install
  include_tasks: beta.yml
  when: rclone_version == 'beta'

Change /usr/sbin/rclone to /usr/bin/rclone

/usr/sbin/ is not in the default path on Debian 8.5 or Cent OS 7.

Why not change it to /usr/bin?

CentOS Linux release 7.2.1511
/usr/local/bin:/usr/bin

Ubuntu 16.04.1 LTS
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Debian GNU/Linux 8.5 (jessie)
/usr/local/bin:/usr/bin:/bin:/usr/games

maintenance todos

Some notes here:
the whole testing and releasing takes even more effort than the actual role ;-)

  • ansible-galaxy seems to want a release-number > 1: that's still not the case in this repo, I assume I have to do that in a next step. Right now I skip the related test in ansible-lint
  • because the release-number wasn't changed, the latest changes didn't yet get released to galaxy
  • the action we use for linting is outdated: has to be replaced: https://github.com/marketplace/actions/run-ansible-lint
  • I added meta/runtime.yml to make ansible-lint happy. The content was taken from an example, it's not correct.

Request: add semantic versioning tags and releases to project

Hi @stefangweichinger

Just an idea that will probably help folks using your great role. I think it would be useful learning experience to setup semantic versioning and releases with tags and a Github action for your repo.

@geerlingguy (who I note uses your role too) has an existing config you might consider re-using to do the same.

This helps us folks who import and lock specific versions of roles that are known to work in our own projects from Galaxy, ie.

# requirements.yml
# Install dependency roles from Galaxy
- src: geerlingguy.docker
  version: 6.0.4
- src: geerlingguy.pip
  version: 2.2.0
- src: stefangweichinger.ansible_rclone
#  version: x.x.x

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.