Get salt-master ip from salt_master_ip, not from iface
diff --git a/maas/files/curtin_userdata_amd64_generic_trusty b/maas/files/curtin_userdata_amd64_generic_trusty
index 07a3273..ecfbc41 100644
--- a/maas/files/curtin_userdata_amd64_generic_trusty
+++ b/maas/files/curtin_userdata_amd64_generic_trusty
@@ -24,7 +24,7 @@
 {% endraw %}
   salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"]
   salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion"]
-  salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{grains['ip4_interfaces']['enp0s3'][0]}}' >> /etc/salt/minion"]
+  salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{ salt_master_ip }} >> /etc/salt/minion"]
 {% raw %}
 {{if third_party_drivers and driver}}
   driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg"
diff --git a/maas/files/curtin_userdata_amd64_generic_xenial b/maas/files/curtin_userdata_amd64_generic_xenial
index 8bec9c4..2c4b294 100644
--- a/maas/files/curtin_userdata_amd64_generic_xenial
+++ b/maas/files/curtin_userdata_amd64_generic_xenial
@@ -24,7 +24,7 @@
 {% endraw %}
   salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"]
   salt_03_hostname_get: ["curtin", "in-target", "--", "sh", "-c", "echo 'id: {% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}' >> /etc/salt/minion"]
-  salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{grains['ip4_interfaces']['enp0s3'][0]}}' >> /etc/salt/minion"]
+  salt_04_master: ["curtin", "in-target", "--", "sh", "-c", "echo 'master: {{ salt_master_ip }} >> /etc/salt/minion"]
 {% raw %}
 {{if third_party_drivers and driver}}
   driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg"
diff --git a/maas/region.sls b/maas/region.sls
index f2a9e4f..3f4237e 100644
--- a/maas/region.sls
+++ b/maas/region.sls
@@ -53,6 +53,8 @@
   - user: root
   - group: root
   - mode: 644
+  - context:
+      salt_master_ip: {{ region.salt_master_ip }}
   - require:
     - pkg: maas_region_packages
 
@@ -63,6 +65,8 @@
   - user: root
   - group: root
   - mode: 644
+  - context:
+      salt_master_ip: {{ region.salt_master_ip }}
   - require:
     - pkg: maas_region_packages