Hi Michael,
Thank you for your feedback.
On 14-09-14 15:38, Michael DeHaan wrote:
> The stdout in one case is "0" and another is "1" so this seems to be
> working as designed.
>
> As such, I think this would be the way your system is setup (aka it
> works correctly) or your grep needs modification.
>
> Ansible *appears* to be doing what you want.
Tried more stuff and got a useful error. It appears that Ansible does
not pass in the *name* from the 'allowuser' list as item in the sed
command but instead throws in *all* the 'results' text:
"cmd": "sed -i 's|^AllowUsers |AllowUsers {u'changed': True, ...
Obviously that will make sed fail. So what do I need to change to make
it use just the name from the 'allowuser' list?
Full error:
TASK: [builder | builder | Add user to AllowUsers]
****************************
failed: [
test.nl] => (item={u'stdout': u'0', u'changed': True, u'end':
u'2014-09-14 16:07:04.437150', 'item': u'testuser', u'cmd': u'grep -i -c
testuser /etc/ssh/sshd_config', u'rc': 1, u'start': u'2014-09-14
16:07:04.433035', u'stderr': u'', u'delta': u'0:00:00.004115',
'invocation': {'module_name': u'shell', 'module_args': u'grep -i -c
testuser /etc/ssh/sshd_config'}}) => {"changed": true, "cmd": "sed -i
's|^AllowUsers |AllowUsers {u'changed': True, u'end': u'2014-09-14
16:07:04.437150', u'stdout': u'0', u'cmd': u'grep -i -c testuser
/etc/ssh/sshd_config', 'item': u'testuser', u'delta': u'0:00:00.004115',
u'stderr': u'', u'rc': 1, 'invocation': {'module_name': u'shell',
'module_args': u'grep -i -c testuser /etc/ssh/sshd_config'}, u'start':
u'2014-09-14 16:07:04.433035'} |' /etc/ssh/sshd_config", "delta":
"0:00:00.005010", "end": "2014-09-14 16:07:04.567878", "item":
{"changed": true, "cmd": "grep -i -c testuser /etc/ssh/sshd_config",
"delta": "0:00:00.004115", "end": "2014-09-14 16:07:04.437150",
"invocation": {"module_args": "grep -i -c testuser
/etc/ssh/sshd_config", "module_name": "shell"}, "item": "testuser",
"rc": 1, "start": "2014-09-14 16:07:04.433035", "stderr": "", "stdout":
"0"}, "rc": 1, "start": "2014-09-14 16:07:04.562868"}
stderr: sed: -e expression #1, char 60: unterminated `s' command
FATAL: all hosts have already failed -- aborting
Thanks,
Patrick
> send an email to ansible-project+unsubscribe@__
googlegroups.com
> <mailto:
ansible-project%2Bunsu...@googlegroups.com>.
> To post to this group, send email to
> ansible-project@googlegroups.__com
> <mailto:
ansible...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/__msgid/ansible-project/__5414C302.8030703%40puzzled.__xs4all.nl
> <
https://groups.google.com/d/msgid/ansible-project/5414C302.8030703%40puzzled.xs4all.nl>.
> For more options, visit
https://groups.google.com/d/__optout
> <
https://groups.google.com/d/optout>.
>
>
> --
> 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
ansible-proje...@googlegroups.com
> <mailto:
ansible-proje...@googlegroups.com>.
> To post to this group, send email to
ansible...@googlegroups.com
> <mailto:
ansible...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyjuP0Nr5vy2%2B7iZ0EdYsYJ1rGR1g2xHES9nZaXNUCDMw%40mail.gmail.com
> <
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyjuP0Nr5vy2%2B7iZ0EdYsYJ1rGR1g2xHES9nZaXNUCDMw%40mail.gmail.com?utm_medium=email&utm_source=footer>.