Would anyone have the syntax of stat.mode? I'm trying to check the
permissions of a file using ansible 1.9.4 but I''m getting the error:
fatal: [USSLTCSNL5039.solutions.glbsnet.com] => error while evaluating
conditional: foo_conf_file.stat.mode == '0600'
FATAL: all hosts have already failed -- aborting
Thank you
---
- hosts: myservers
remote_user: deploy
become: yes
become_method: sudo
vars:
FOO_CONF: /tmp/foo.conf
# Check for the existance of /tmp/foo.conf
# place the results into foo_conf_file
# check "{{ FOO_CONF }}".stat.exists
tasks:
- name: Check file
stat: path="{{ FOO_CONF }}"
register: foo_conf_file
- debug: msg="Oops File does not exist"
when: foo_conf_file.stat.exists == False
- debug: msg="Check permissions"
when: foo_conf_file.stat.mode == '0600'
--
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/19842f25-ee66-4bfc-a613-0298ce614ea5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.