Ansible: lineinfile syntax error when there is a space after colon(:)

后端 未结 2 854
遇见更好的自我
遇见更好的自我 2021-01-15 08:19

Ansible\'s lineinfile gives a syntax error when there\'s a space after colon(:) in the line, like line=\'item: value\'. If there\'s no space like <

2条回答
  •  我在风中等你
    2021-01-15 09:06

    Escape the colon as {{ ":" }}:

    - name: set up sudo for testgroup
      lineinfile: dest=/etc/sudoers line='%testgroup ALL= NOPASSWD{{ ":" }} /sbin/shutdown -r now' state=present insertafter=EOF validate='visudo -cf %s'
    

提交回复
热议问题