> > Using the shell module to call perl to replace text in a file is jumping > through a lot of hoops. Ansible aims for simple. I'd recommend using the > template module (http://docs.ansible.com/template_module.html) and > template out the whole sudoers file. If you must >
I already switch to use the template: module sfor it, just see it is strange. It should work but not work as expected. I hope we found some bug somewhere and clean it up. > replace text, use the replace module: > http://docs.ansible.com/replace_module.html. In either case I'd > recommend you use the "validate" option, so you can ensure the sudoers file > has the proper syntax and you don't lock yourself out of the box. > > - James > > > On Saturday, November 22, 2014 6:19:07 PM UTC-5, Steve Kieu wrote: >> >> Hi all, >> >> ansible complian about these >> >> >> - name: allow group wheel to run sudo with password >> shell: "perl -i.bak -pe 's|^# >> \%wheel[\s\\t]+ALL\=\(ALL\)[\s\\t]+NOPASSWD|\%wheel >> ALL\=(ALL\) NOPASSWD|g' /etc/sudoers creates=/etc/sudoers.bak" >> >> yaml lint syntax check go green :-) >> >> ansible says: >> >> ERROR: Syntax Error while loading YAML script, >> /etc/ansible/localhost/roles/base/tasks/05-usersetup.yml >> Note: The error may actually appear before this position: line 11, column >> 34 >> >> - name: allow group wheel to run sudo with password >> shell: "perl -i.bak -pe 's|^# >> \%wheel[\s\\t]+ALL\=\(ALL\)[\s\\t]+NOPASSWD|\%wheel >> ALL\=(ALL\) NOPASSWD|g' /etc/sudoers creates=/etc/sudoers.bak" >> >> I think it mis understand some characters there but not sure what. Any >> idea? >> >> >> Kind regards >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/B7hzC36EqOY/unsubscribe. > To unsubscribe from this group and all its topics, 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/9bbfe0a7-4c19-4e3a-b667-049244449f53%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/9bbfe0a7-4c19-4e3a-b667-049244449f53%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Steve Kieu -- 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/CAAQ-o%2B8edPrk5YmTzc7zLMcPKvWEdYRFL3Fx93Lnenj%2BKg1ovg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
