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

Speed up "minimize access on found files" task #208

Closed
907th opened this issue Jan 21, 2019 · 4 comments
Closed

Speed up "minimize access on found files" task #208

907th opened this issue Jan 21, 2019 · 4 comments

Comments

@907th
Copy link

907th commented Jan 21, 2019

Hello! "minimize access on found files" is a veryyyyy looong task. Do you consider any improvements on the speed of this task?

@rndmh3ro
Copy link
Member

Hey @907th,

yeah, that's pretty slow. However this is really hard to get right.
I'm playing around with async and loops but thats really complicated with inner and outer loops.
And even if I get this running, I don't know if the speed will improve.

Here's my current state:

- name: get all folders asynced
  tags: loop
  find:
    paths: "{{ async_item }}"
    recurse: yes
    file_type: file
    hidden: true
  async: 450
  poll: 10
  loop: "{{ all_folders }}"
  loop_control:
    loop_var: "async_item"
  register: async_results

#- name: Check sync status
#  tags: loop
#  async_status:
#    jid: "{{ async_result_item.ansible_job_id }}"
#  loop: "{{ async_results.results }}"
#  loop_control:
#    loop_var: "async_result_item"
#  register: async_poll_results
#  until: async_poll_results.finished
#  retries: 30


- name: minimize access on found files
  tags: loop
  file:
    path: '{{ item.1.path }}'
    mode: 'go-w'
    state: file
  #with_items: '{{ async_results.results}}'
  with_subelements:
    - '{{ async_results.results}}'
    - 'files'

@907th
Copy link
Author

907th commented Jan 22, 2019

@rndmh3ro How about executing a shell script which would find and fix file permissions right on the remote server, without looping on ansible machine?

@rndmh3ro
Copy link
Member

Yeah, or just a command with file... I'll have to check what to use. Looping and the current solution are not optimal.

@rndmh3ro
Copy link
Member

#209

rndmh3ro added a commit that referenced this issue Jul 24, 2020
fix multiple match rules not working #207
divialth pushed a commit to divialth/ansible-collection-hardening that referenced this issue Aug 3, 2022
fix multiple match rules not working dev-sec#207
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