Can we run parallel jobs in Ansible

0 votes
Aug 4, 2019 in Ansible by Rajendra
• 480 points

retagged Aug 5, 2019 by Kalgi 1,830 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, 2019 by Kalgi
• 51,950 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, 2019 in Ansible by Barbara
526 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, 2019 in Ansible by Nicolas
8,042 views
0 votes
1 answer
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, 2019 in Ansible by Rajendra
• 480 points
1,591 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
675 views
+2 votes
1 answer
0 votes
1 answer

what is the difference between tags and delegate_to in ansible?

Hey @Rajendra, If you wish to perform ...READ MORE

answered Sep 24, 2019 in Ansible by Kalgi
• 51,950 points
532 views
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
• 51,950 points
1,977 views