generate static & dhcp network config
Tony Mack [Tue, 19 Jan 2016 16:55:35 +0000 (16:55 +0000)]
gen_network_config.sh [new file with mode: 0755]
local.yml

diff --git a/gen_network_config.sh b/gen_network_config.sh
new file mode 100755 (executable)
index 0000000..785ff0e
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+source /tmp/planet.cnf
+
+cat << EOF >> /etc/network/interfaces.d/eth0
+auto eth0
+iface eth0 inet dhcp
+
+auto eth0:0
+iface eth0:0 inet static
+        address $IP_ADDRESS
+        netmask $IP_NETMASK
+        gateway $IP_GATEWAY
+EOF
index 6169cb5..4a3ec67 100644 (file)
--- a/local.yml
+++ b/local.yml
@@ -13,3 +13,6 @@
 
       - name: Run sshd
         service: name=ssh state=started
+
+      - name: Generate network config
+        script: gen_network_config.sh