Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to enable/disable task overhead #167

Open
Xyz00777 opened this issue Aug 11, 2024 · 4 comments
Open

option to enable/disable task overhead #167

Xyz00777 opened this issue Aug 11, 2024 · 4 comments

Comments

@Xyz00777
Copy link

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
Copy link
Author

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

@stefangweichinger
Copy link
Owner

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 ...

@stefangweichinger
Copy link
Owner

this went stale ... I currently don't have the ressources to add this feature, but PRs are welcome.
I assume this would be rather easy (maybe):

  • some toggle "binary: yes/no"
  • some task(s) installing from the repos depending on that

@stefangweichinger
Copy link
Owner

OK, I started thinking about this feature again.

This would need additional distro-specific values for the name of the rclone-package: package names might vary between distributions.

The logic in main.yml would have to be changed/enhanced: many tasks would not be needed if installing from upstream (reducing the number of executed tasks is what the OP wants).

I might do some tests in a feature-branch. I don't promise anything right now ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants