path: root/docs
diff options
authorThomas Wiest <>2015-06-04 10:08:06 -0400
committerThomas Wiest <>2015-06-04 10:12:29 -0400
commite43fc1b515fa87994228098e00632360ea5946b5 (patch)
tree1438f8816b8fc57e4575b93b58b8e7a0c8a732e9 /docs
parentf906869478dee3f471d1a4f0908845c763c1ebfa (diff)
Added YAML over JSON to best practices guide.
Diffstat (limited to 'docs')
1 files changed, 24 insertions, 2 deletions
diff --git a/docs/best_practices_guide.adoc b/docs/best_practices_guide.adoc
index 2768059b3..841f6e72c 100644
--- a/docs/best_practices_guide.adoc
+++ b/docs/best_practices_guide.adoc
@@ -78,6 +78,27 @@ metadata[line] = results.pop()
== Ansible
+=== Yaml Files (Playbooks, Roles, Vars, etc)
+| **Rule**
+| Ansible files SHOULD NOT use JSON (use pure YAML instead).
+YAML is a superset of JSON, which means that Ansible allows JSON syntax to be interspersed. Even though YAML (and by extension Ansible) allows for this, JSON SHOULD NOT be used.
+* Ansible is able to give clearer error messages when the files are pure YAML
+* YAML reads nicer (preference held by several team members)
+* YAML makes for nicer diffs as YAML tends to be multi-line, whereas JSON tends to be more concise
+* Ansible static inventory files are INI files. To pass in variables for specific hosts, Ansible allows for these variables to be put inside of the static inventory files. These variables can be in JSON format, but can't be in YAML format. This is an acceptable use of JSON, as YAML is not allowed in this case.
+Every effort should be made to keep our Ansible YAML files in pure YAML.
=== Defensive Programming
@@ -122,8 +143,6 @@ If an Ansible role requires certain variables to be set, it's best to check for
=== Roles
-*[Ansible Suggested Directory Layout]
@@ -132,6 +151,9 @@ If an Ansible role requires certain variables to be set, it's best to check for
| The Ansible roles directory MUST maintain a flat structure.
+*[Ansible Suggested Directory Layout]
.The purpose of this rule is to:
* Comply with the upstream best practices
* Make it familiar for new contributors