{"id":17962184,"url":"https://github.com/skyzyx/ansible-coding-standards","last_synced_at":"2026-03-19T02:36:59.393Z","repository":{"id":66710360,"uuid":"67831205","full_name":"skyzyx/ansible-coding-standards","owner":"skyzyx","description":"Ansible/YAML Coding Standards","archived":false,"fork":false,"pushed_at":"2016-09-09T20:40:54.000Z","size":2,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T18:15:19.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skyzyx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-09T20:38:39.000Z","updated_at":"2023-11-30T09:35:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"b55d51e7-cadc-412f-aa05-366b09117c46","html_url":"https://github.com/skyzyx/ansible-coding-standards","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyzyx%2Fansible-coding-standards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyzyx%2Fansible-coding-standards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyzyx%2Fansible-coding-standards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyzyx%2Fansible-coding-standards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyzyx","download_url":"https://codeload.github.com/skyzyx/ansible-coding-standards/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247061160,"owners_count":20877165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T11:14:28.788Z","updated_at":"2026-01-16T00:50:20.205Z","avatar_url":"https://github.com/skyzyx.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible/YAML Coding Standards\n\nThe key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHALL\", \"SHALL NOT\", \"SHOULD\", \"SHOULD NOT\", \"RECOMMENDED\", \"MAY\", and \"OPTIONAL\" in this document are to be interpreted as described in [RFC 2119](http://tools.ietf.org/html/rfc2119).\n\nYou are encouraged to add the dotfiles from this repository to your project, and use an editor/IDE which understands them — otherwise, know how to apply these rules to your files manually.\n\n## Elements of a good playbook\n\n* YAML documents (including Ansible playbooks) MUST begin a document with `---` followed by one empty line.\n\n  ```yaml\n  ---\n  \n  # Begin playbook...\n  ```\n\n* Every task MUST have a `name`.\n\n* Every task MUST have 1 or more appropriate tags, annotated as an array instead of a single string.\n\n  ```yaml\n  # Good\n  tags:\n    - abc\n\n  # Bad\n  tags: abc\n  ```\n\n* You SHOULD use the built-in Ansible task (when available) instead of simply calling-out to the shell. See [Ansible: List of all modules](http://docs.ansible.com/ansible/list_of_all_modules.html) for more information. In certain cases, Ansible actions are not yet powerful enough to replace Bash actions.\n\n* Any use of `when` SHOULD happen _after_ the primary action (e.g., \"do this thing _when_ this condition is met\").\n\n* Binary decisions MUST use `yes`/`no` instead of `true`/`false`.\n\n## Editor Settings\n\n* Indentation should be 2 spaces. Further, arrays (i.e., lines which begin with `-`) should be indented 2 spaces from its parent as well.\n\n* Line-endings MUST use the `\\n` character (`LF`) used by default on Mac OS X and *nix systems.\n\n* Lines MUST NOT have trailing whitespace.\n\n* A file MUST end with a single empty line feed.\n\n* Files MUST use only UTF-8 _without_ BOM as its character encoding.\n\n## Whitespace\n\n* Files SHOULD have soft-limit of `80` characters per line. Valid exceptions are when you have an unbreaking line.\n\n* Files SHOULD use long-form YAML, not short-form YAML.\n\n  ```yaml\n  # Good\n  - name: Make new symlink\n    file:\n      state: link\n      owner: root\n      group: root\n      src: /usr/local/okapi/{{ version }}\n      path: /usr/local/okapi/okapi_new\n\n  # Bad\n  - name: Make new symlink\n    file: state=link owner=root group=root src=/usr/local/okapi/{{ version }} path=/usr/local/okapi/okapi_new\n  ```\n\n## Comments\n\n* Non-documentation comments are strongly encouraged. A general rule of thumb is that if you look at a section of code and think \"Wow, I don't want to try and describe that\", you need to comment it before you forget how it works.\n\n* For readability, comments MUST have a single space after `#`.\n\n  ```yaml\n  # Good Comment\n  \n  #Bad Comment\n  #    Bad Comment\n  #  Bad Comment\n  ```\n\n* There SHOULD always be one line of whitespace above the start of a comment block.\n\n  ```yaml\n  # This is my code.\n  key: ansible_command\n  \n  # This is more code.\n  key: another_ansible_command\n  ```\n\n* For inline comments (e.g., commenting-out a line), the comment MUST begin after the appropriate indentation, prefixing the line with a `# ` (hash-space). You MUST NOT add a `#` to the beginning of a line, being irrespective of indentation.\n\n  ```yaml\n  # Good\n  abc:\n    def:\n      # - 123\n      - 456\n      - 789\n\n  # Bad\n  abc:\n    def:\n  #    - 123\n      - 456\n      - 789\n  ```\n\n## Spelling\n\nIf there is ever a discrepancy between English-speaking dialects, use **U.S. English** as a baseline for both spelling and word choice. [Grammarist](http://grammarist.com/spelling/) and similar websites can help ensure intended usage.\n\n```\ncolor (correct)\ncolour (incorrect)\n\nspelled (correct)\nspelt (incorrect)\n\ncanceled (correct)\ncancelled (incorrect)\n\nlabeled (correct)\nlabelled (incorrect)\n\nmath (correct)\nmaths (incorrect)\n\napartment (correct)\nflat (incorrect)\n\n\"Apple is very successful.\" (correct)\n\"Apple are very successful.\" (incorrect)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyzyx%2Fansible-coding-standards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyzyx%2Fansible-coding-standards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyzyx%2Fansible-coding-standards/lists"}