Attract new users with high-quality Ansible Collections
Tags: ansible, webinar, ansiblecollections
Published: 2020-12-08 13:58:07

**WORDS BY** Tadej Borovšak

The IT industry has been increasing in complexity for quite some time now. Organizations have to find a way to manage an additional maintenance burden. Most of them are trying to solve the problem via automation. But this cultural shift towards the DevOps and site reliability engineering disciplines has one significant consequence for **product owners: automation is becoming the preferred method for adopting new technologies.**

High-quality Ansible Collection can help eliminate barriers to adoption and improve the reliability of onboarding new technology. But the benefits of offering customers a high-quality Ansible Collection extend beyond the day-1 operations. When appropriately designed, Ansible roles and modules can be of great help in day-2 operations.

#**What makes an Ansible Collection high quality**
A high-quality Ansible Collection **puts the user experience above all else.** Its two primary purposes are:

1. Make it possible to write human-readable Ansible playbooks that describe the desired state.
2. Enforce the desired state from the Ansible playbook safely and reliably.

Because Ansible Collections provide essential building blocks for Ansible playbooks (modules and roles), **readability and robustness are highly dependent on the quality of the Ansible content.**

#**State improves Ansible playbook’s readability**
One of the more important traits of a high-quality Ansible Collection is its focus on the result. Let us look at the next playbook task:

```
- name: Rudimentary auto-remediation hook
  sensu.sensu_go.hook:
    name: restart_nginx
    command: sudo systemctl start nginx
    timeout: 60
    stdin: false
```

Because the [sensu.sensu_go.hook] (https://sensu.github.io/sensu-go-ansible/modules/hook.html) module is enforcing a state, the full description of the steps it takes when it executes the sample task would be:

1. If the `restart_nginx` hook does not exist, create it.
For each task’s parameter, make sure current and desired values are synchronized.
2. Report back if we changed anything.
3. Imagine what a mess our Ansible playbooks would be if we would need to add all that conditional logic to our task.

The focus on the desired state is also crucial for day-2 operations. The [sensu.sensu_go.hook] (https://sensu.github.io/sensu-go-ansible/modules/hook.html) Ansible module will only update the hook if there is a change in the hook’s definition. And if all Ansible modules that we use in our Ansible playbook work this way, we can safely run the Ansible playbook multiple times without risking breaking our deploy.

We can also reuse the same Ansible playbook for detecting unauthorized configuration changes. Tracking down the rouge system administrator might be a bit harder, but that is another story ;)

#**But there is more**
The above example demonstrates one property that each high-quality Ansible Collection should have. If you are interested in hearing more tips and tricks about designing, coding, testing, and maintaining a high-quality Ansible content, we are hosting a free on-demand webinar **Speed up the adoption of automation with high-quality Ansible Collections** that was also featured at this year’s [AnsibleFest 2020] (https://agenda.fest.ansible.com/sessions?p1=eyJzcGVha2VyIjpbXSwidGltZXNsb3QiOltdLCJkYXkiOltdLCJyb29tIjpbXSwibG9jYXRpb24iOltdLCJzdGFydCI6IiIsImZpbmlzaCI6IiIsInBhZ2VudW1iZXIiOjEsImNhdGVnb3JpZXMiOnt9LCJrZXl3b3JkIjoiU3BlZWQtdXAgdGhlIGFkb3B0aW9uIG9mIGF1dG9tYXRpb24gd2l0aCBoaWdoLXF1YWxpdHkgQW5zaWJsZSBDb2xsZWN0aW9ucyJ9). **Register [here] (https://steampunk.si/webinars-training/speed-up-automation-ansible-collections/).**

Cheers!