HomeAutomation Tools

Ansible Tips and Tricks & Ansible Vault Commands

Ansible Tips and Tricks & Ansible Vault Commands
Like Tweet Pin it Share Share Email
Personal Development Category (English)728x90

Ansible is widely used automation tool in the IT. In this article and the video, you will learn basic tips and tricks and also Ansible Vault commands to use Ansible Playbooks in a better way.

Ansible Vault

Suggestable Read:

1. Introduction and Installation & Configuration of Ansible 2.3 on CentOS/Redhat Linux 7

2. Configuring Ansible Dynamic Inventory for AWS EC2

3. Creating an Ansible static inventory with variables

4. Part #1: Getting Started with Ansible Ad-Hoc Commands

5. Part #2: Getting Started with Ansible Ad-Hoc Commands

6.  Ansible: Getting Started with Ansible Playbook

7.  Ansible Playbook #2: Adding Multiple Users with Sudo access and private key

8.  Ansible Playbook #3: Spinning up the EC2 instance – AWS

9. Ansible | Quick Introduction to Static and Dynamic Inventories

 

Ansible Tricks and Tips:

Below are the basic Ansible tips to get more knowledge on executing the Ansible Commands :

– List all tasks in the playbook
– Start the play from a particular task
– Start the play step by step with interactive way. This will prompt the user for to confirm each task before running.
– Check syntax of the playbook
– Execute the playbook in the check (dry-run) mode, which checks what changes will be performed.
– List hosts on which playbook will be executed
– List tags in the playbook
– Only run plays and tasks tagged with these tag values
– Skip the tasks associated with specific tasks
– The –forks what lets ansible run on multiple hosts in parallel. NUM is specified as an integer, the default is 5.
– Run a playbook on the target hosts without inventory files.

 

List all tasks in the playbook

 

Start the play from a particular task

 

Start the play step by step with interactive way. This will prompt the user for to confirm each task before running.

 

Check the syntax of the playbook

 

Execute the playbook in the check (dry-run) mode, which checks what changes will be performed.

 

List hosts on which playbook will be executed

 

List tags in the playbook

 

Only run plays and tasks tagged with these tag values

 

Skip the tasks associated with specific tasks

 

The -forks what lets ansible run on multiple hosts in parallel. NUM is specified as an integer, the default is 5.

 

Run a playbook on the target hosts without inventory files.

 

Follow our Youtube Channel for more about Ansible Tutorials :

Check out the below Video for More about Ansible Trick and Tips.

Ansible Vault :
Ansible Vault is tool provided by Ansible for encrypting/decrypting the secret information stored in the playbooks and files controlled under Ansible. For example critical information such as passwords or ssh keys. With version 2.3 Ansible is capable to encrypt single values which were not possible earlier i.e. Earlier it was only possible to encrypt the whole file. Ansible vault is also capable to encrypt/decrypt the binary files too, for example, if we got a file in the files directory and we use copy module to deploy the file on the remote server, it will be deployed in unencrypted form. Security check or vault password authentication will be performed when you run the playbook responsible for copying the file over. Ansible uses AES 256 cipher for the encryption.

While encrypting user you will be asked to supply a new password, when editing/viewing/decrypting an existing file need to enter the existing password.

To create a new encrypted file

 

To encrypted existing files

 

To update/re-key the files (new password)

 

Editing the encrypted file

 

Viewing the Encrypting Files

 

Decrypting files

 

Follow our Youtube Channel for more about Ansible Tutorials :

Check out the below Video for More about Ansible Vault Commands.

 

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.