From ca7f717f7c5046b2d99d72de5ac95f9cc36c4a62 Mon Sep 17 00:00:00 2001 From: Antoine Le Morvan Date: Wed, 8 Dec 2021 12:02:28 +0100 Subject: [PATCH 1/2] Add linter instructions to check playbooks syntax --- docs/books/learning_ansible/01-basic.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/books/learning_ansible/01-basic.md b/docs/books/learning_ansible/01-basic.md index ee8a9a665b..547bc53e37 100644 --- a/docs/books/learning_ansible/01-basic.md +++ b/docs/books/learning_ansible/01-basic.md @@ -811,6 +811,20 @@ You can check the syntax of your playbook: $ ansible-playbook --syntax-check play.yml ``` +You can also use a "linter" for yaml : + +``` +$ dnf install -y yamllint +``` + +then check the yaml syntax of your playbooks : + +``` +$ yamllint test.yml +test.yml + 8:1 error syntax error: could not find expected ':' (syntax) +``` + ## Exercices results * Create the groups Paris, Tokio, NewYork From c4015489b5c10ab6d80f2980f2db88406de4cbf3 Mon Sep 17 00:00:00 2001 From: Antoine Le Morvan Date: Wed, 8 Dec 2021 12:04:18 +0100 Subject: [PATCH 2/2] fix semi-columns --- docs/books/learning_ansible/01-basic.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/books/learning_ansible/01-basic.md b/docs/books/learning_ansible/01-basic.md index 547bc53e37..9065b54dea 100644 --- a/docs/books/learning_ansible/01-basic.md +++ b/docs/books/learning_ansible/01-basic.md @@ -811,13 +811,13 @@ You can check the syntax of your playbook: $ ansible-playbook --syntax-check play.yml ``` -You can also use a "linter" for yaml : +You can also use a "linter" for yaml: ``` $ dnf install -y yamllint ``` -then check the yaml syntax of your playbooks : +then check the yaml syntax of your playbooks: ``` $ yamllint test.yml