<commit_before>---
layout: post
title: "15 Things You Should Know About Ansible"
date: 2016-01-12T19:05:11-02:00
keywords: ansible, devops
author: marlonbernardes
excerpt: >
  I've been working a lot with Ansible lately and decided to share some things I learned along the way.
  In this post you'll find a list of 15 things I think you should know about Ansible.
---

I've been working a lot with Ansible lately and decided to share some things I learned along the way. Below you'll find a list of 15 things I think you should know about Ansible. Missing something? Just leave a comment and share your own tips!

## 1 - You can pass parameters to roles

It's a good practice to create roles to organize your playbooks. Let's say we want to create a role for installing Jenkins. The folder structure for this role could look something like this:

```
myapplication/
   files/
   templates/
   tasks/
   handlers/
   defaults/
```

The folder `defaults` is used to store the values of default vars for a role. Inside of it we could have this `main.yml` file:

```shell
jenkins_port: 8080
jenkins_context_path: /jenkins
jenkins_home: /jenkins
```

You could overwrite the default variables, by passing different parameters to the role like so:<commit_msg>Fix folder name in example<commit_after>---
layout: post
title: "15 Things You Should Know About Ansible"
date: 2016-01-12T19:05:11-02:00
keywords: ansible, devops
author: marlonbernardes
excerpt: >
  I've been working a lot with Ansible lately and decided to share some things I learned along the way.
  In this post you'll find a list of 15 things I think you should know about Ansible.
---

I've been working a lot with Ansible lately and decided to share some things I learned along the way. Below you'll find a list of 15 things I think you should know about Ansible. Missing something? Just leave a comment and share your own tips!

## 1 - You can pass parameters to roles

It's a good practice to create roles to organize your playbooks. Let's say we want to create a role for installing Jenkins. The folder structure for this role could look something like this:

```
jenkins/
   files/
   templates/
   tasks/
   handlers/
   defaults/
```

The folder `defaults` is used to store the values of default vars for a role. Inside of it we could have this `main.yml` file:

```shell
jenkins_port: 8080
jenkins_context_path: /jenkins
jenkins_home: /jenkins
```

You could overwrite the default variables, by passing different parameters to the role like so:
{'fraction_non_alphanumeric': 0.05968961400716275, 'fraction_numerical': 0.023079984082769598, 'mean_word_length': 3.978217821782178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '417990', 'n_tokens_mistral': 765, 'n_tokens_neox': 680, 'n_words': 387}