stefangweichinger / ansible-rclone

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

option to enable/disable task overhead #167

Open Xyz00777 opened 2 months ago

Xyz00777 commented 2 months ago

hi first i want to say, nice work! I have just stumbled across this project and implemted it into my ansible playbook, but i was really confused when nearly 24 (if i counted correct) task was executed when i myself jsut configured. my config:

---
- name: play rclone install and mount
  hosts: localhost
  tasks:
    - name: install rclone
      # https://ansible-tips-and-tricks.readthedocs.io/en/latest/os-dependent-tasks/installing_packages/
      become: true
      action: >
        {{ ansible_pkg_mgr }} name={{ item }} state=present update_cache=yes
      with_items:
        - rclone
        - yamllint
    - name: configure rclone
      # https://github.com/stefangweichinger/ansible-rclone
      ansible.builtin.include_role:
        name: stefangweichinger.ansible_rclone
      vars:
        rclone_configs:
          - name: services_crypt
            properties:
              type: crypt
              remote: sftp:/nextcloud
              filename_encryption: off
              directory_name_encryption: false
          - name: sftp
            properties:
              type: sftp
              host: 192.168.0.2
              user: srv-xxxx
              pass: XXXXXXXXXXXX

executed tasks:

[root@nextcloud ansible]# ansible-playbook rclone.yml 
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [play rclone install and mount] *******************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [install rclone] **********************************************************************************************************************************************************************************************************************
ok: [localhost] => (item=yamllint)

TASK [configure rclone] ********************************************************************************************************************************************************************************************************************

TASK [stefangweichinger.ansible_rclone : Gather OS specific variables] *********************************************************************************************************************************************************************
ok: [localhost] => (item=/root/.ansible/roles/stefangweichinger.ansible_rclone/vars/RedHat.yml)

TASK [stefangweichinger.ansible_rclone : Create directory for ansible custom facts] ********************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Create facts file from template] ******************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Re-read facts after adding custom fact] ***********************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Check latest stable rclone version number] ********************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Set variable to latest stable version number] *****************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Check latest beta rclone version number] **********************************************************************************************************************************************************
skipping: [localhost]

TASK [stefangweichinger.ansible_rclone : Set variable for beta version] ********************************************************************************************************************************************************************
skipping: [localhost]

TASK [stefangweichinger.ansible_rclone : Install the binary] *******************************************************************************************************************************************************************************
included: /root/.ansible/roles/stefangweichinger.ansible_rclone/tasks/install-bin.yml for localhost

TASK [stefangweichinger.ansible_rclone : Update repositories cache on Ubuntu] **************************************************************************************************************************************************************
skipping: [localhost]

TASK [stefangweichinger.ansible_rclone : Install required packages] ************************************************************************************************************************************************************************
ok: [localhost] => (item=unzip)
ok: [localhost] => (item=man)
ok: [localhost] => (item=file)

TASK [stefangweichinger.ansible_rclone : Remove temporary working directory] ***************************************************************************************************************************************************************
changed: [localhost]

TASK [stefangweichinger.ansible_rclone : Create temporary working directory] ***************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Do beta install] **********************************************************************************************************************************************************************************
skipping: [localhost]

TASK [stefangweichinger.ansible_rclone : Do stable install] ********************************************************************************************************************************************************************************
included: /root/.ansible/roles/stefangweichinger.ansible_rclone/tasks/stable.yml for localhost

TASK [stefangweichinger.ansible_rclone : Get rclone stable version 1.67.0] *****************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Get list of files extracted from the rclone archive] **********************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Copy rclone binary] *******************************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Make dir for local manpages] **********************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Copy rclone manpage] ******************************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Update mandb] *************************************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Create config directory] **************************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Set up rclone config] *****************************************************************************************************************************************************************************
ok: [localhost]

TASK [stefangweichinger.ansible_rclone : Mount rclone] *************************************************************************************************************************************************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************************************************************************************************************************************************************************
localhost                  : ok=21   changed=1    unreachable=0    failed=0    skipped=5    rescued=0    ignored=0

I can understand the idea that downloading and installing the newest upstream package is nice but in my opinion it adds a good amount of overheard to doing these every time the play is running and also some users are okay with the default installed from the operating system repositorys, wouldnt it possible to let the users decide if they want to install from repo or let them install in an own task rclone from OS package manager? because at least 18 ( i didnt looked into the tasks explicitly to see if the would become unneaded, i just looked at the name) of these task wouldnt be needed than...

greetings Xyz00777

Xyz00777 commented 2 months ago

i would also say that it should be disabled from default, but based on backwards compatibility i understood that these is not possible

stefangweichinger commented 2 months ago

Well, the README says that the role installs directly from upstream, and not from the distribution repos ;-)

I once started a PR to add a toggle to install from the repos, but it never was finished (and you are the first to ask for that, btw).

I see the benefits of that, this feature might be added, yes. But don't expect that to happen too soon ...