Skip to content

Commit dc7a438

Browse files
committed
If mac address is configured use that for interface creation
Allows setting custom mac addresses for newly created virtual interfaces.
1 parent 3c95b9c commit dc7a438

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ Role Variables
8181
- `network`: Name of the network to which an interface should be
8282
attached. Must be specified if and only if the interface `type` is
8383
`network`.
84+
- `mac`: "Hardware" address of the virtual instance, if absent one is created
8485
- `source`: A dict defining the host interface to which this
8586
VM interface should be attached. Must be specified if and only if the
8687
interface `type` is `direct`. Includes the following attributes:

templates/vm.xml.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
<interface type='network'>
4848
<source network='{{ interface.network }}'/>
4949
{% endif %}
50+
{% if interface.mac %}
51+
<mac address='{{ interface.mac }}'/>
52+
{% endif %}
5053
{# if the network configuration is invalid this can still appear in the xml #}
5154
{# (say you enter 'bond' instead of 'bridge in your variables) #}
5255
<model type='virtio'/>

0 commit comments

Comments
 (0)