'Ansible modules parameter syntax
Why is it that on the playbook.yml under the command task to be executed, some modules have a quotation mark while some does not?
For example, if you check the syntax below, the module line is with embedded in a quotation mark but script is not.
- name: 'Execute a script on all web server nodes and start httpd service'
hosts: web_nodes
tasks:
- name: 'Update entry into /etc/resolv.conf'
lineinfile:
path: /etc/resolv.conf
line: 'nameserver 10.1.250.10'
- name: 'Execute a script'
script: /tmp/install_script.sh
Solution 1:[1]
Both modules take as parameter for line or cmd a string.
Why is it that ... some modules have a quotation mark while some does not?
Your question is about the YAML Syntax
which is how Ansible playbooks (our configuration management language) are expressed.
when to quote and YAML Gotchas
While you can put just about anything into an unquoted scalar, there are some exceptions.
Also a style guide can be a reason of different ways of when and how to quote.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | U880D |
