Difference between revisions of "Ansible-lint"

From wikieduonline
Jump to navigation Jump to search
Line 5: Line 5:
 
* Ubuntu: <code>[[apt install ansible-lint]]</code>
 
* Ubuntu: <code>[[apt install ansible-lint]]</code>
  
<pre>
 
ansible-lint your-playbook.txt
 
We were unable to read either as JSON nor YAML, these are the errors we got from each:
 
JSON: Expecting value: line 2 column 1 (char 1)
 
  
Syntax Error while loading YAML.
+
ansible-lint your-playbook.txt
  mapping values are not allowed in this context
+
We were unable to read either as JSON nor YAML, these are the errors we got from each:
 
+
JSON: Expecting value: line 2 column 1 (char 1)
The error appears to be in '/home/ubuntu/your-playbook.txt': line 9, column 34, but may
+
be elsewhere in the file depending on the exact syntax problem.
+
Syntax Error while loading YAML.
 
+
  [[mapping values are not allowed in this context]]
The offending line appears to be:
+
 
+
The error appears to be in '/home/ubuntu/your-playbook.txt': line 9, column 34, but may
    - name: Add a user to a password file and ensure permissions are set
+
be elsewhere in the file depending on the exact syntax problem.
      community.general.htpasswd:
+
                                ^ here
+
The offending line appears to be:
</pre>
+
 +
    - name: Add a user to a password file and ensure permissions are set
 +
        community.general.htpasswd:
 +
                                  ^ here
  
 
== Related commands ==
 
== Related commands ==

Revision as of 15:51, 22 April 2022

ansible-lint checks playbooks for practices and behaviour that could potentially be improved. As a community backed project ansible-lint supports only the last two major versions of Ansible.


ansible-lint your-playbook.txt
We were unable to read either as JSON nor YAML, these are the errors we got from each:
JSON: Expecting value: line 2 column 1 (char 1)

Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to be in '/home/ubuntu/your-playbook.txt': line 9, column 34, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

    - name: Add a user to a password file and ensure permissions are set
       community.general.htpasswd:
                                 ^ here

Related commands

See also

Advertising: