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,230 points
1,706 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,440 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,440 points
1,065 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
3,520 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,440 points
2,090 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,440 points
13,302 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