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,880 points
274 views

1 answer to this question.

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,810 points
745 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,810 points
5,279 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,810 points
177 views
0 votes
1 answer
+13 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,380 points
214 views
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
832 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
131 views