How to import files in Ansible-Playbook

0 votes

Hi Guys,

I have one Ansible-Playbook. But in this playbook, I have to use a username and password. For security reasons, I want to import a password from another file. How can I do that in Ansible?

Aug 11, 2020 in Ansible by akhtar
• 38,260 points
2,021 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use vars_files keyword in Ansible. This is used to import multiple files in Ansible Playbook as shown below.

- hosts: localhost
  vars_files:
          - var.yml

Now you can use the data of this file in your playbook.

answered Aug 11, 2020 by MD
• 95,460 points

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to create a variable in Ansible Playbook?

Hi@akhtar, Variable in playbooks are very similar to using variables in ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,460 points
1,324 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+2 votes
1 answer
0 votes
1 answer

How to copy files in remote system using Ansible?

Hi@akhtar, You need to use the copy module ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,460 points
2,389 views
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,460 points
14,405 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP