You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Issue
If during a run, a logfile is configured to say keep X histories but are uniquely named (e.g. sessionlauncher.log.2023-09-21-14-19) and that log file vanishes, then the task will fail.
Expected Behavior
Task ignores the fact a file no longer exists and carries on with the next file.
Actual Behavior
A clear and concise description of what's happening.
Control(s) Affected
4.2.3
Environment (please complete the following information):
branch being used: [e.g. devel]
Ansible Version: [e.g. 2.10]
Host Python Version: [e.g. Python 3.7.6]
Ansible Server Python Version: [e.g. Python 3.7.6]
branch being used: main
Ansible Version: ansible 2.10.8
Host Python Version: 3.10.12
Ansible Server Python Version: 3.10.12 (same - being run locally)
Additional Details:
We are targetting AWS WorkSpaces Ubuntu offering.
I'm running into the same issue. I've found one quick fix which significantly reduces the likelihood of the issue occurring, and then another more elaborate solution which fully covers the issue.
This prevents ansible.builtin.file from trying to run on a log file where the permissions are already correct. As most log files seem to have the correct permissions by default, this resolves the issue for most situations.
The second solution was to create a separate file with a block/rescue which would be used to set the permissions. In the same cis_4.2.3.yml file as before, change:
- name: "4.2.3 | PATCH | Ensure permissions on all logfiles are configured | change permissions"
ansible.builtin.file:
path: "{{ item.path }}"
mode: '0640'
loop: "{{ logfiles.files }}"
to:
- name: "4.2.3 | PATCH | Ensure permissions on all logfiles are configured | change permissions"
ansible.builtin.include_tasks: set_perms.yml
vars:
perms_mode: '0640'
loop: "{{ logfiles.files }}"
Describe the Issue
If during a run, a logfile is configured to say keep X histories but are uniquely named (e.g. sessionlauncher.log.2023-09-21-14-19) and that log file vanishes, then the task will fail.
Expected Behavior
Task ignores the fact a file no longer exists and carries on with the next file.
Actual Behavior
A clear and concise description of what's happening.
Control(s) Affected
4.2.3
Environment (please complete the following information):
branch being used: [e.g. devel]
Ansible Version: [e.g. 2.10]
Host Python Version: [e.g. Python 3.7.6]
Ansible Server Python Version: [e.g. Python 3.7.6]
branch being used: main
Ansible Version: ansible 2.10.8
Host Python Version: 3.10.12
Ansible Server Python Version: 3.10.12 (same - being run locally)
Additional Details:
We are targetting AWS WorkSpaces Ubuntu offering.
Additional Notes
Sample error message:
Possible Solution
Task ignores errors? This feels a little brittle...
The text was updated successfully, but these errors were encountered: