Serialize localhost actions during final host deployment

Several tasks in the final playbooks run locally and there is a chance
to encounter race conditions when multiple tasks run in parallel and
all of them access or modify the same local files. We fix this by
splitting the final steps into multiple plays and serializing those
that run locally. Finally, the 'serial' keyword can only be used for
an entire play and not just for a subset of its tasks provided by a
role so previously that keyword did not have any effect.

Change-Id: Ib0a55dcd4b02e070a6be72207f0b99e8138e0e12
This commit is contained in:
Markos Chandras 2016-10-04 09:32:03 +01:00
parent 6e14419d42
commit 87a32c6311
3 changed files with 27 additions and 10 deletions

View File

@ -85,17 +85,22 @@
- role: ironic-enroll-dynamic - role: ironic-enroll-dynamic
- { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true }
- hosts: baremetal - hosts: baremetal
vars: name: "Create configuration drive files."
inventory_dhcp_static_ip: "{{ inventory_dhcp_static_ip | bool == true }}"
multinode_testing: true
name: "Creat configuration drive files and deploy machines."
become: no become: no
connection: local connection: local
roles: roles:
- role: bifrost-configdrives-dynamic - role: bifrost-configdrives-dynamic
- hosts: baremetal
vars:
inventory_dhcp_static_ip: "{{ inventory_dhcp_static_ip | bool == true }}"
multinode_testing: true
name: "Deploy machines."
become: no
connection: local
serial: 1
roles:
- role: bifrost-deploy-nodes-dynamic - role: bifrost-deploy-nodes-dynamic
- role: bifrost-prepare-for-test-dynamic - role: bifrost-prepare-for-test-dynamic
serial: 1
# The testvm Host group is added by bifrost-prepare-for-test based # The testvm Host group is added by bifrost-prepare-for-test based
# on the contents of the CSV file. # on the contents of the CSV file.
- hosts: test - hosts: test

View File

@ -73,11 +73,17 @@
- role: ironic-enroll-dynamic - role: ironic-enroll-dynamic
- { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true }
- hosts: baremetal - hosts: baremetal
name: "Creat configuration drive files and deploy machines." name: "Create configuration drive files."
become: no become: no
connection: local connection: local
roles: roles:
- role: bifrost-configdrives-dynamic - role: bifrost-configdrives-dynamic
- hosts: baremetal
name: "Deploy machines."
become: no
connection: local
serial: 1
roles:
- role: bifrost-deploy-nodes-dynamic - role: bifrost-deploy-nodes-dynamic
- role: bifrost-prepare-for-test-dynamic - role: bifrost-prepare-for-test-dynamic
# The testvm Host group is added by bifrost-prepare-for-test based # The testvm Host group is added by bifrost-prepare-for-test based

View File

@ -87,16 +87,22 @@
- { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true }
- hosts: baremetal - hosts: baremetal
vars: name: "Create configuration drive files."
multinode_testing: "{{ inventory_dhcp | bool == true }}"
name: "Create configuration drive files and deploy machines."
become: no become: no
connection: local connection: local
roles: roles:
- role: bifrost-configdrives-dynamic - role: bifrost-configdrives-dynamic
- hosts: baremetal
vars:
multinode_testing: "{{ inventory_dhcp | bool == true }}"
name: "Deploy machines."
become: no
connection: local
serial: 1
roles:
- role: bifrost-deploy-nodes-dynamic - role: bifrost-deploy-nodes-dynamic
- role: bifrost-prepare-for-test-dynamic - role: bifrost-prepare-for-test-dynamic
serial: 1
# The testvm Host group is added by bifrost-prepare-for-test based # The testvm Host group is added by bifrost-prepare-for-test based
# on the contents of the CSV file. # on the contents of the CSV file.