Can we run parallel jobs in Ansible

0 votes
Aug 4 in Ansible by Rajendra
• 280 points

retagged Aug 5 by Kalgi 32 views

1 answer to this question.

+1 vote

Running parallel tasks in Ansible is not a problem. Ansible or in fact any kind of configuration management tool was meant for this. They are suppossed to be provisioning multiple host systems simultaneously and hence parallel execution of jobs is one of their strengths. 

You can achieve the parallel execution of tasks on Ansible by just using a keyword called 'serial' in the following manner:

- name: test play
  hosts: webservers
  serial: 2
  gather_facts: False
  tasks:
  - name: task one
    command: hostname
  - name: task two
    command: hostname
answered Aug 5 by Kalgi
• 40,440 points

Related Questions In Ansible

0 votes
1 answer

Run Ansible adhoc commands in sequence

Hey @Thomas, by default ansible runs these ...READ MORE

answered Jan 14 in Ansible by Barbara
104 views
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
1,867 views
0 votes
0 answers

how can we unarchive multiple different files using ansible-playbook? i tried this yml file its getting error

---   - hosts: all     become: yes     vars:     - path: /home/ansadmin     tasks:     - name: ...READ MORE

Aug 17 in Ansible by Rajendra
• 280 points
29 views
+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
147 views
0 votes
1 answer
0 votes
1 answer

One loop over multiple Ansible tasks

With_items has unfortunately stopped but it’s coming ...READ MORE

answered Jul 23, 2018 in Ansible by Kalgi
• 40,440 points
699 views
0 votes
1 answer

Ansible iterate over hash with condition

Your when statement is wrong. you either split ...READ MORE

answered Jul 23, 2018 in Ansible by Kalgi
• 40,440 points
187 views