diff --git a/tests/azure/templates/build_container.yml b/tests/azure/templates/build_container.yml
index 7d5c1fb0700089bf4b945c78601296b493ff1987..f66b76aaebb0ada660f83806d1a0d8a7ca35fa5e 100644
--- a/tests/azure/templates/build_container.yml
+++ b/tests/azure/templates/build_container.yml
@@ -19,12 +19,15 @@ jobs:
       versionSpec: '${{ parameters.python_version }}'
 
   - script: python -m pip install --upgrade pip setuptools wheel ansible
+    retryCountOnTaskFailure: 5
     displayName: Install tools
 
   - script: pip install molecule[docker]
+    retryCountOnTaskFailure: 5
     displayName: Install molecule
 
   - script: molecule create -s ${{ parameters.build_scenario_name }}
+    retryCountOnTaskFailure: 5
     displayName: Create test container
     env:
       ANSIBLE_LIBRARY: ./molecule
diff --git a/tests/azure/templates/galaxy_pytest_script.yml b/tests/azure/templates/galaxy_pytest_script.yml
index 1f629b29b6a8246ffd2bf7b666961a5ace444de9..68a051c9a77e0d1ea1e6642970e2996e18825703 100644
--- a/tests/azure/templates/galaxy_pytest_script.yml
+++ b/tests/azure/templates/galaxy_pytest_script.yml
@@ -25,16 +25,21 @@ jobs:
       pip install \
         "molecule[docker]>=3" \
         "ansible${{ parameters.ansible_version }}"
+    retryCountOnTaskFailure: 5
     displayName: Install molecule and Ansible
 
   - script: ansible-galaxy collection install community.docker ansible.posix
+    retryCountOnTaskFailure: 5
     displayName: Install Ansible collections
 
   - script: pip install -r requirements-tests.txt
+    retryCountOnTaskFailure: 5
     displayName: Install dependencies
+
   - script: |
       utils/build-galaxy-release.sh -i
       molecule create -s ${{ parameters.scenario }}
+    retryCountOnTaskFailure: 5
     displayName: Setup test container
     env:
       ANSIBLE_LIBRARY: ./molecule
diff --git a/tests/azure/templates/galaxy_script.yml b/tests/azure/templates/galaxy_script.yml
index 57ce8d3a98426303806bf12f4f8ad1a61456ba24..3564c9cccc6c82740e924ae0c36ab2a71d683e4a 100644
--- a/tests/azure/templates/galaxy_script.yml
+++ b/tests/azure/templates/galaxy_script.yml
@@ -35,17 +35,21 @@ jobs:
       pip install \
         "molecule[docker]>=3" \
         "ansible${{ parameters.ansible_version }}"
+    retryCountOnTaskFailure: 5
     displayName: Install molecule and Ansible
 
   - script: ansible-galaxy collection install community.docker ansible.posix
+    retryCountOnTaskFailure: 5
     displayName: Install Ansible collections
 
   - script: pip install -r requirements-tests.txt
+    retryCountOnTaskFailure: 5
     displayName: Install dependencies
 
   - script: |
       utils/build-galaxy-release.sh -i
       molecule create -s ${{ parameters.scenario }}
+    retryCountOnTaskFailure: 5
     displayName: Setup test container
     env:
       ANSIBLE_LIBRARY: ./molecule
diff --git a/tests/azure/templates/playbook_fast.yml b/tests/azure/templates/playbook_fast.yml
index ef613cd01093cec59b5a8d2d692f4ed79ac3fc75..962315a8b6c2f0450f878182d5c85f0e4f9c3d94 100644
--- a/tests/azure/templates/playbook_fast.yml
+++ b/tests/azure/templates/playbook_fast.yml
@@ -34,20 +34,25 @@ jobs:
       pip install \
         "molecule[docker]>=3" \
         "ansible${{ parameters.ansible_version }}"
+    retryCountOnTaskFailure: 5
     displayName: Install molecule and Ansible
 
   - script: ansible-galaxy collection install community.docker ansible.posix
+    retryCountOnTaskFailure: 5
     displayName: Install Ansible collections
 
   - script: pip install -r requirements-tests.txt
+    retryCountOnTaskFailure: 5
     displayName: Install dependencies
 
   - script: |
+      rm -rf ~/ansible
       mkdir -p ~/.ansible/roles ~/.ansible/library ~/.ansible/module_utils
       cp -a roles/* ~/.ansible/roles
       cp -a plugins/modules/* ~/.ansible/library
       cp -a plugins/module_utils/* ~/.ansible/module_utils
       molecule create -s ${{ parameters.scenario }}
+    retryCountOnTaskFailure: 5
     displayName: Setup test container
     env:
       ANSIBLE_LIBRARY: ./molecule
diff --git a/tests/azure/templates/playbook_tests.yml b/tests/azure/templates/playbook_tests.yml
index 729a8975d4f0162a8d3b247e50e748687637a637..712dfb6226039c0b9d61f32d7c8bc6c64f5377fe 100644
--- a/tests/azure/templates/playbook_tests.yml
+++ b/tests/azure/templates/playbook_tests.yml
@@ -34,20 +34,25 @@ jobs:
       pip install \
         "molecule[docker]>=3" \
         "ansible${{ parameters.ansible_version }}"
+    retryCountOnTaskFailure: 5
     displayName: Install molecule and Ansible
 
   - script: ansible-galaxy collection install community.docker ansible.posix
+    retryCountOnTaskFailure: 5
     displayName: Install Ansible collections
 
   - script: pip install -r requirements-tests.txt
+    retryCountOnTaskFailure: 5
     displayName: Install dependencies
 
   - script: |
+      rm -rf ~/ansible
       mkdir -p ~/.ansible/roles ~/.ansible/library ~/.ansible/module_utils
       cp -a roles/* ~/.ansible/roles
       cp -a plugins/modules/* ~/.ansible/library
       cp -a plugins/module_utils/* ~/.ansible/module_utils
       molecule create -s ${{ parameters.scenario }}
+    retryCountOnTaskFailure: 5
     displayName: Setup test container
     env:
       ANSIBLE_LIBRARY: ./molecule
diff --git a/tests/azure/templates/pytest_tests.yml b/tests/azure/templates/pytest_tests.yml
index 6afd58905a526d7a4d911602d8c030423410eac9..99fb320615fd7cece1aec05a5d24f7b94deb00b1 100644
--- a/tests/azure/templates/pytest_tests.yml
+++ b/tests/azure/templates/pytest_tests.yml
@@ -28,20 +28,25 @@ jobs:
       pip install \
         "molecule[docker]>=3" \
         "ansible${{ parameters.ansible_version }}"
+    retryCountOnTaskFailure: 5
     displayName: Install molecule and Ansible
 
   - script: ansible-galaxy collection install community.docker ansible.posix
+    retryCountOnTaskFailure: 5
     displayName: Install Ansible collections
 
   - script: pip install -r requirements-tests.txt
+    retryCountOnTaskFailure: 5
     displayName: Install dependencies
 
   - script: |
+      rm -rf ~/.ansible
       mkdir -p ~/.ansible/roles ~/.ansible/library ~/.ansible/module_utils
       cp -a roles/* ~/.ansible/roles
       cp -a plugins/modules/* ~/.ansible/library
       cp -a plugins/module_utils/* ~/.ansible/module_utils
       molecule create -s ${{ parameters.scenario }}
+    retryCountOnTaskFailure: 5
     displayName: Setup test container
     env:
       ANSIBLE_LIBRARY: ./molecule