aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/infra_create_vms
diff options
context:
space:
mode:
authorStepan Andrushko <stepanx.andrushko@intel.com>2018-08-23 16:13:47 +0300
committerStepan Andrushko <stepanx.andrushko@intel.com>2018-08-30 18:01:44 +0300
commit7e507932a091c0ab7049efc907ee2d0857aadb21 (patch)
tree437655c41548f48009ae1c995e16f0e150713ce4 /ansible/roles/infra_create_vms
parent662de49b9f6c116d15882aed9e678cd3cf67494b (diff)
Adopt infra_deploy to spawn VM on LTS Ubuntu 18
Add possibility ro reuse infra_deploy.yaml to spawn VMs on jump host, depending on jump host Ubuntu version: either 16 or 18. JIRA: YARDSTICK-1396 Change-Id: Id0682c03098e611fe3a51cbd24d8ff2dda7c552a Signed-off-by: Stepan Andrushko <stepanx.andrushko@intel.com>
Diffstat (limited to 'ansible/roles/infra_create_vms')
-rw-r--r--ansible/roles/infra_create_vms/tasks/create_interfaces.yml13
1 files changed, 11 insertions, 2 deletions
diff --git a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
index 34bfd1b71..12b2726dc 100644
--- a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
+++ b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
@@ -12,6 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
+- set_fact:
+ mac_address_arg: "mac_address"
+
+- set_fact:
+ mac_address_arg: "macaddress"
+ when:
+ - ansible_distribution == 'Ubuntu'
+ - ansible_distribution_major_version|int >= 18
+
- name: Add network-data
blockinfile:
path: "{{ network_config }}"
@@ -20,9 +29,9 @@
block: |2
{{ 'enp0s%d:'| format( slot_address | int) }}
match:
- mac_address: {{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }}
+ {{ mac_address_arg }}: {{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }}
addresses:
- - {{ interface_item.ip }}/{{ interface_item.netmask }}
+ - {{ interface_item.ip }}/{{ (interface_item.ip + '/' + interface_item.netmask) | ipaddr('prefix') }}
- name: Add default gateway
blockinfile: