Bradley A. Thornton
Bradley A. Thornton
Starting to pull in possible rule ideas from the community of practice: https://github.com/redhat-cop/automation-good-practices/pull/64 A task in a task file or play performs an action, the name of the task should...
The use of with_ is "discouraged" and "loop" is preferred. Although with_ is not deprecated, this would be a good optional rule for people wanting to future proof their playbooks.
The `|` should be surrounded by spaces for readability: Bad: ``` - ansible_facts.network_resources.bfd_interfaces|symmetric_difference(result.after)|length ``` Good: ``` - ansible_facts.network_resources.bfd_interfaces | symmetric_difference(result.after) | length ```
This is ok: ``` loop: - red - green - blue loop_control: loop_var: rgb_color ``` This is not, no loop_var ``` loop: - a - b - c ```
and that is has a meaningful name not `item` This is ok: `name: "Start the requested service. {{ serivce_name }}"` This should not be: `name: "Enable {{ item.1 }}"`
This one might be tricky because it will depend on the task, to it might only be best to start with a couple simple ones: ```yaml ansible.builtin.include_tasks: "{{ test_case_to_run }}...
As an opt in rule until profile support is available we should disallow yaml ignorant style argument definition for tasks: e.g. ``` - debug: msg="END connection={{ ansible_connection }} nxos_linkagg sanity...
We should be able to determine with some degree of confidence that a yaml file is a playbook and warn they should be in a ./playbooks directory.
As seen in this PR: https://github.com/ansible-collections/cisco.nxos/pull/504/files (was done with this hacky little cleanup script, in `def update_set_fact_name`) https://gist.github.com/cidrblock/865826d5cfa2bd7d1ce028ffe9067a1b
This is not really necessary in a collection world, the dep can be at the collection level and a task can be used to run the role. Basically we want...