Skip to Content
Security Automation with Ansible 2
book

Security Automation with Ansible 2

by Akash Mahajan, MADHU AKULA
December 2017
Intermediate to advanced
364 pages
7h 30m
English
Packt Publishing
Content preview from Security Automation with Ansible 2

How to use Ansible Vault with variables and files

The following examples demonstrate how we can use secrets in our playbook variable files.

Let's take an example of installing MySQL server in an Ubuntu operating system using the following playbook. As per the Ansible documentation, it's easy and better to store Vault variables and normal variables differently. 

The following code snippet is the high-level file structure for installing MySQL server with the root password:

├── group_vars│   └── mysql.yml # contains vault secret values├── hosts├── main.yml└── roles    └── mysqlsetup        └── tasks            └── main.yml

Now we can see that the mysqlsetup role contains the following tasks that require the mysql_root_password variable, which contains the root password ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Implementing DevOps with Ansible 2

Implementing DevOps with Ansible 2

Jonathan McAllister
Practical Ansible 2

Practical Ansible 2

Daniel Oh, James Freeman, Fabio Alessandro Locati

Publisher Resources

ISBN: 9781788394512Supplemental Content