Understanding and Working with Ansible Vault with Playbooks
Description
---------------------
Shadab Akhtar is DevOps Consultant, Linux Expert, and Corporate Problem Solver with 10 years and 7 months experiences
Shadab Akhtar designs solutions, deploys the technology, and provides expertise on business system performance, architecture, and security
Shadab Akhtar Bachelors( 70.94%) and Masters(67.89%) in Computer Science with DIT University, Dehradun Uttarakhand, India.
• Expertise :
---------------------
• DevOps, Cloud Computing(AWS, Azure and GCP), Linux, Shell, Python Scripting and Hadoop
Follow Me On:
------------------------
YouTube: Shadab Akhtar Official
Gmail: shadabakhtar97@gmail.com
Twitter: @shadabakhtar97
GitHub: shadabakhtargithub
Linkedin: https://www.linkedin.com/in/shadab-akhtar-ba69a362
Facebook: https://www.facebook.com/shadab.akhtar.5682
Instagram: shadabakhtar29
Contact:
+91-9148627170
shadabakhtar97@gmail.com
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Step1: Create ansible vault for more than one passwd
$ ansbile-vault create passwd.yml
Keep Sensitive Data Details here
Create Playbook for variables file(passwd.yml) and used ansible build in function
# Playbook: Ansible Vault for more than one password
---
- hosts: all
become: true
vars_files: passwd.yml
tasks:
- ansible.builtin.debug:
msg: The value of the variable from passwd.yml file is {{ PASSWD1 }}
$ ansible-playbook --ask-vault-pass p4PaswdDetails.yml
Vault password:
PLAY [webservers] ****************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************
TASK [ansible.builtin.debug] ******************************************************************************************************
ok: [remote@172.31.39.162] = {
"msg": "The vaule of variable from passwd.yml is admin3"
}
ok: [remote@172.31.35.81] = {
"msg": "The vaule of variable from passwd.yml is admin3"
}
PLAY RECAP ************************************************************************************************************************
remote@172.31.35.81 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
remote@172.31.39.162 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Issue:
=====
$ ansible all -m shell -a "sudo mv /home/control/passwd.yml /home/remote/"
# ansible webservers -m copy -a "src=/var/log/secure dest=/tmp/"
# ansible webservers -m copy -a "src=/home/control/passwd.yml dest=/home/remote/"
$ ansible webservers -m copy -a "src=/home/control/passwd.yml dest=/home/remote/"
Solution:
========
$ ansible webservers -m copy -a "src=/home/control/passwd.yml dest=/home/remote/" --ask-vault-pass
Vault password:
"
Видео Understanding and Working with Ansible Vault with Playbooks канала Shadab Akhtar Official
---------------------
Shadab Akhtar is DevOps Consultant, Linux Expert, and Corporate Problem Solver with 10 years and 7 months experiences
Shadab Akhtar designs solutions, deploys the technology, and provides expertise on business system performance, architecture, and security
Shadab Akhtar Bachelors( 70.94%) and Masters(67.89%) in Computer Science with DIT University, Dehradun Uttarakhand, India.
• Expertise :
---------------------
• DevOps, Cloud Computing(AWS, Azure and GCP), Linux, Shell, Python Scripting and Hadoop
Follow Me On:
------------------------
YouTube: Shadab Akhtar Official
Gmail: shadabakhtar97@gmail.com
Twitter: @shadabakhtar97
GitHub: shadabakhtargithub
Linkedin: https://www.linkedin.com/in/shadab-akhtar-ba69a362
Facebook: https://www.facebook.com/shadab.akhtar.5682
Instagram: shadabakhtar29
Contact:
+91-9148627170
shadabakhtar97@gmail.com
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Step1: Create ansible vault for more than one passwd
$ ansbile-vault create passwd.yml
Keep Sensitive Data Details here
Create Playbook for variables file(passwd.yml) and used ansible build in function
# Playbook: Ansible Vault for more than one password
---
- hosts: all
become: true
vars_files: passwd.yml
tasks:
- ansible.builtin.debug:
msg: The value of the variable from passwd.yml file is {{ PASSWD1 }}
$ ansible-playbook --ask-vault-pass p4PaswdDetails.yml
Vault password:
PLAY [webservers] ****************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************
TASK [ansible.builtin.debug] ******************************************************************************************************
ok: [remote@172.31.39.162] = {
"msg": "The vaule of variable from passwd.yml is admin3"
}
ok: [remote@172.31.35.81] = {
"msg": "The vaule of variable from passwd.yml is admin3"
}
PLAY RECAP ************************************************************************************************************************
remote@172.31.35.81 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
remote@172.31.39.162 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Issue:
=====
$ ansible all -m shell -a "sudo mv /home/control/passwd.yml /home/remote/"
# ansible webservers -m copy -a "src=/var/log/secure dest=/tmp/"
# ansible webservers -m copy -a "src=/home/control/passwd.yml dest=/home/remote/"
$ ansible webservers -m copy -a "src=/home/control/passwd.yml dest=/home/remote/"
Solution:
========
$ ansible webservers -m copy -a "src=/home/control/passwd.yml dest=/home/remote/" --ask-vault-pass
Vault password:
"
Видео Understanding and Working with Ansible Vault with Playbooks канала Shadab Akhtar Official
Комментарии отсутствуют
Информация о видео
3 ноября 2023 г. 10:30:31
00:47:15
Другие видео канала