stefangweichinger / ansible-rclone

ansible role for rclone :: https://galaxy.ansible.com/stefangweichinger/ansible_rclone
157 stars 56 forks source link

Rclone config location #138

Open hongbo-miao opened 1 year ago

hongbo-miao commented 1 year ago

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! 😃

stefangweichinger commented 1 year ago

Thanks for your feedback. I have to think about this ... currently busy.

stefangweichinger commented 1 month ago

is that maybe obsolete now with 0.2.0 ?