Hi!
I have a role that clean my /etc/cron.d , /etc/cron.daily, etc... and
installs new crons that I have defined in the role. For this duty I've do a
simple but powerfull playbook but in version 2.0 instead of skeep a steep,
I see a deprecation warning.
Example:
## LOOK IF PLACEHOLDER FILE EXISTS AND REGISTER IN A VAR
- stat:
path=/etc/cron.d/placeholder
register: placeholdercrond
tags: ["cron.all", "cron.d"]
## IF NOT EXISTS, LIST ALL FILES AND STORE THEM IN A VAR
- shell: ls -1 /etc/cron.d
register: crond
when: placeholdercrond.stat.exists == False
tags: ["cron.all", "cron.d"]
## DELETE EVERY FILE IF LAST COMMAND WHERE TRUE BECAUSE crond VAR HAS VALUES
- file:
path=/etc/cron.d/{{ item }}
state=absent
with_items: crond.stdout_lines
when: crond.changed == True
tags: ["cron.all", "cron.d"]
- WHEN NOT PLACEHOLDER FILE: PLAYBOOK RUN OK
- WHEN THERE IS A PLACEHOLDER FILE: PLAYBOOK SHOWS A DEPRECATION, FUTURE
ERROR IN FILE MODULE
PLAY
***************************************************************************
TASK [setup]
*******************************************************************
TASK [cron : stat]
*************************************************************
ok: [testserver]
TASK [cron : command]
**********************************************************
ok: [testserver]
TASK [cron : file]
*************************************************************
[DEPRECATION WARNING]: Skipping task due to undefined attribute, in the
future this will be a fatal error.. This feature will be removed in a
future release. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
This is because {{ item }} is empty, but this steep should be skipped
because the when: condition is not meeted.
Any ideas?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/16efbd78-1e45-4b7d-8860-089083ab19e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.