Hi Team,
I have a bug in the code that is simple to fix but hard to find out. It
took me almost 30 minutes to see but it is due to the fact that yml
indentation syntax quirkness!
Lets see the block below
- block:
- name: disable sssd service for non production nodes by all means
service: name=sssd state=stopped enabled=no
ignore_errors: True
- shell: "chmod -x /init.d/sssd.sh || true"
- shell: "kill `ps -ef|grep '/usr/sbin/sssd' | grep -v grep | awk
'{print $2}'` || true"
- name: remove the sss service from nsswitch.conf
replace: dest=/etc/nsswitch.conf regexp='^(.*) sss$' replace='\1'
backup=yes
when: host_type not in [ 'production', 'livepreview' ]
You see the fact that after the - it *must* be a space (right?) so the when
condition allied to the whole block needs to be match with exactly the b of
the block. Or course if I set tab width to 2 it would be it if the start of
the line press tab, but if I set tab to any other size, it wont, I need to
align it exactly two spaces!
After a long block the alignment does not look good anymore and harder to
spot out indentation error.
Can I do something like -[TAB]block and from that only use TAB so it does
not matter TAB size, I can always use tab for indentation?
--
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/c65099be-0cfc-479d-bef7-0e5491eabeb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.