From 87a32c631167ade7a0f620391fbd18378c7e6819 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 4 Oct 2016 09:32:03 +0100 Subject: [PATCH] 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 --- playbooks/test-bifrost-dhcp.yaml | 15 ++++++++++----- playbooks/test-bifrost-dynamic.yaml | 8 +++++++- playbooks/test-bifrost.yaml | 14 ++++++++++---- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/playbooks/test-bifrost-dhcp.yaml b/playbooks/test-bifrost-dhcp.yaml index 45dcd464a..ac535335d 100644 --- a/playbooks/test-bifrost-dhcp.yaml +++ b/playbooks/test-bifrost-dhcp.yaml @@ -85,17 +85,22 @@ - role: ironic-enroll-dynamic - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } - hosts: baremetal - vars: - inventory_dhcp_static_ip: "{{ inventory_dhcp_static_ip | bool == true }}" - multinode_testing: true - name: "Creat configuration drive files and deploy machines." + name: "Create configuration drive files." become: no connection: local roles: - 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-prepare-for-test-dynamic - serial: 1 # The testvm Host group is added by bifrost-prepare-for-test based # on the contents of the CSV file. - hosts: test diff --git a/playbooks/test-bifrost-dynamic.yaml b/playbooks/test-bifrost-dynamic.yaml index 4a8c1e96d..cb2671ced 100644 --- a/playbooks/test-bifrost-dynamic.yaml +++ b/playbooks/test-bifrost-dynamic.yaml @@ -73,11 +73,17 @@ - role: ironic-enroll-dynamic - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } - hosts: baremetal - name: "Creat configuration drive files and deploy machines." + name: "Create configuration drive files." become: no connection: local roles: - role: bifrost-configdrives-dynamic +- hosts: baremetal + name: "Deploy machines." + become: no + connection: local + serial: 1 + roles: - role: bifrost-deploy-nodes-dynamic - role: bifrost-prepare-for-test-dynamic # The testvm Host group is added by bifrost-prepare-for-test based diff --git a/playbooks/test-bifrost.yaml b/playbooks/test-bifrost.yaml index a7b52b2f1..fe6856252 100644 --- a/playbooks/test-bifrost.yaml +++ b/playbooks/test-bifrost.yaml @@ -87,16 +87,22 @@ - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } - hosts: baremetal - vars: - multinode_testing: "{{ inventory_dhcp | bool == true }}" - name: "Create configuration drive files and deploy machines." + name: "Create configuration drive files." become: no connection: local roles: - 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-prepare-for-test-dynamic - serial: 1 # The testvm Host group is added by bifrost-prepare-for-test based # on the contents of the CSV file.