Changeset - 83c953f83425
[Not reviewed]
0 1 0
Branko Majic (branko) - 7 years ago 2017-08-11 12:59:14
branko@majic.rs
MAR-114: Added development conventions section covering task specification (ordering of parameters, syntax etc).
1 file changed with 47 insertions and 0 deletions:
0 comments (0 inline, 0 general)
docs/development.rst
Show inline comments
 
@@ -57,6 +57,53 @@ performing the following steps:
 
     pip-sync
 

	
 

	
 
Development conventions
 
-----------------------
 

	
 
In order to maintain consistency across different roles and documentation, this
 
section describes development conventions that should be followed while making
 
modifications.
 

	
 

	
 
Task specifications
 
~~~~~~~~~~~~~~~~~~~
 

	
 
When writing new and updating existing tasks, keep the following in mind:
 

	
 
- Quote sensibly. If specifying paths (for example ``src``, ``dest``, ``path``
 
  etc in various models), quote the string to make it stand-out better and to
 
  avoid breakages.
 
- Avoid usage of ``set_facts`` task when same functionality can be achieved via
 
  ``defaults/main.yml``.
 
- When specifying tasks, use the fully expanded form. Do not use single-line
 
  form with ``param=value``.
 
- When specifying ``command`` or ``shell`` tasks, in case a ``creates``
 
  parameter or such need to be used, specify them as part of task's ``args``
 
  parameter. E.g.::
 

	
 
    - name: Run command
 
      command: mycommand
 
      args:
 
        creates: "/etc/mycommand"
 

	
 
- When sepcifying tasks, keep the following ordering between different task
 
  parameters:
 

	
 
  - ``name``
 
  - Module and its parameters.
 
  - ``become``
 
  - ``become_user``
 
  - ``when``
 
  - ``with_items`` / ``with_dict`` / ``with_nested``
 
  - ``wait_for``
 
  - ``register``
 
  - ``changed_when``
 
  - ``failed_when``
 
  - ``no_log``
 
  - ``notify``
 
  - Task tags.
 

	
 

	
 
Running role tests directly
 
---------------------------
 

	
0 comments (0 inline, 0 general)