Define variables in Ansible Playbook

0 votes
This might sound very stupid but I'm a noob and I want to know how to set variables in a playbook. Thank you
Jan 24 in Ansible by Noor

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Variable names should be letters, numbers, and underscores. Variables should always start with a letter.

You can define variables directly in a playbook:

- hosts: webservers
    http_port: 80
answered Jan 24 by Jinha

Related Questions In Ansible

0 votes
1 answer

ansible playbook: using multiple variables in loops

Use an indexed hostname, and then define ...READ MORE

answered Jul 16, 2018 in Ansible by DareDev
• 6,670 points
0 votes
1 answer

Role of subelement module in an Ansible playbook

Hey @Rahul thanks for a better question ...READ MORE

answered Jan 16 in Ansible by Emily
0 votes
1 answer

Is it possible to run an Ansible Playbook in python script?

Hey @Cerci, Of course its possible. You ...READ MORE

answered Jan 17 in Ansible by Nicolas
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How do I access environment variables in Ansible?

Yes @Nagray, you're right! You can access ...READ MORE

answered Jan 24 in Ansible by Tessie
0 votes
1 answer

How do I add ssh authorized keys in ansible playbook?

Hey @kailash use the authorized_key plugin that ...READ MORE

answered Feb 11 in Ansible by Kyra

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.