Using hyphen in ansible

0 votes

I am learning Ansible but I am getting confused when to use hyphen and when not to use hyphen in playbook.

Jul 10, 2018 in Ansible by Nilesh
• 6,900 points
104 views

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
Hyphen - is used to specify list items

 my_list = ['foo', 'bar']

In Ansible you will specify this list items with hyphen:

my_list:

  - foo

  - bar

Inside a playbook you have a list of plays and inside each play you have a list of tasks. Since tasks are lists, each task item is started with a hyphen like this:

tasks:

  - task_1

  - task_2
answered Jul 10, 2018 by Kalgi
• 2,620 points

Related Questions In Ansible

0 votes
1 answer

Using multiple config files using same template in a role in ansible

Go through this include_role module: tasks: - ...READ MORE

answered Jun 5, 2018 in Ansible by DareDev
• 6,520 points
182 views
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,520 points
2,791 views
0 votes
1 answer

Using lxc_container module in ansible

This mostly happens when you've not installed ...READ MORE

answered Aug 10, 2018 in Ansible by DareDev
• 6,520 points
69 views
0 votes
1 answer
+13 votes
2 answers
0 votes
1 answer
0 votes
2 answers

How do you stop Ansible from creating .retry files in the home directory?

[defaults] ... retry_files_enabled = True # Create them ...READ MORE

answered Apr 5 in Ansible by anonymous
444 views
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
54 views

© 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.