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

Fix for state warning in ansible 2.6.5 #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Spreadcat
Copy link

This change fixes the warning in ansible 2.6.5 regarding the state parameter in the module file.

TASK [ansible_role_logrotate : Symlink for hourly rotation] ********************
 [WARNING]: The src option requires state to be 'link' or 'hard'.  This will
become an error in Ansible 2.10

Copy link
Contributor

@hadret hadret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach won't fly -- logrotate_use_hourly_rotation is a boolean and it's always defined in defaults/main.yml. It will result in always creating link, regardless of the boolean value. I think this approach would be better:

- name: Symlink for hourly rotation
  file:
    path: "/etc/cron.hourly/logrotate"
    src: "/etc/cron.daily/logrotate"
    state: link
  when: logrotate_use_hourly_rotation | bool

The caveat with this approach is the change of the behavior -- the symlink won't be cleaned up/removed on the logrotate_use_hourly_rotation change.

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

Successfully merging this pull request may close these issues.

2 participants