aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-30 16:19:23 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-08-30 16:19:23 +0000
commita8706c3b18f7f70798a0b20b1ec15ad496626784 (patch)
tree988dbee4ded7eab4f96207c9f30d15e203853d8d /ansible/roles/infra_create_vms/tasks/create_interfaces.yml
parent7373f7063e234714fc14e1c59b1b24d018e632c0 (diff)
parent7e507932a091c0ab7049efc907ee2d0857aadb21 (diff)
Merge "Adopt infra_deploy to spawn VM on LTS Ubuntu 18"
Diffstat (limited to 'ansible/roles/infra_create_vms/tasks/create_interfaces.yml')
-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: