]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
cobbler: adds cephlab_ubuntu_network snippet 46/head
authorAndrew Schoen <aschoen@redhat.com>
Mon, 1 Jun 2015 20:33:17 +0000 (15:33 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 15 Jun 2015 20:26:45 +0000 (15:26 -0500)
This is used to set the network connectivity for ubuntu nodes after
imaging using DHCP.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
roles/cobbler/defaults/main.yml
roles/cobbler/templates/scripts/cephlab_preseed_late
roles/cobbler/templates/snippets/cephlab_ubuntu_network [new file with mode: 0644]

index b16e0a232ba727e00f349eea1f23496456487958..88caa67d7f4c2edf2d645109028913659c70a1e8 100644 (file)
@@ -16,6 +16,7 @@ snippets:
   - cephlab_rc_local
   - cephlab_rhel_disks
   - cephlab_post_install_kernel_options
+  - cephlab_ubuntu_network
 
 scripts:
   - cephlab_preseed_late
@@ -27,3 +28,10 @@ ssh_keys: []
 
 ansible_user: ''
 ansible_user_uid_: ''
+
+# A list of lines to add to resolv.conf and resolv.conf.d/base
+# An example:
+#   resolvconf:
+#      - "nameserver x.x.x.x"
+#      - "search an.example.com"
+resolvconf: []
index 7f9180efdfe60b2e4708875ab3a1304cd54c2d09..ca04f7227ea0d70992a01c9008628eb1b3af6cf7 100644 (file)
@@ -1,7 +1,7 @@
 ## {{ ansible_managed }}
 # Start preseed_late_default
 # This script runs in the chroot /target by default
-$SNIPPET('post_install_network_config_deb')
+$SNIPPET('cephlab_ubuntu_network')
 # set kernel options as defined by the system, profile or distro
 # in the Kernel Options (Post Install) field which populates the var kernel_options_post
 $SNIPPET('cephlab_post_install_kernel_options')
diff --git a/roles/cobbler/templates/snippets/cephlab_ubuntu_network b/roles/cobbler/templates/snippets/cephlab_ubuntu_network
new file mode 100644 (file)
index 0000000..6c8f484
--- /dev/null
@@ -0,0 +1,44 @@
+### {{ ansible_managed }}
+#set os_version = $getVar('os_version','')
+#if $os_version == 'vivid'
+# deleting interfaces we don't need for vivid.
+# if these are in place then vivid wants to use eth2 as the
+# primary interface
+sed -i '/eth2/d' /etc/udev/rules.d/70-persistent-net.rules
+sed -i '/eth3/d' /etc/udev/rules.d/70-persistent-net.rules
+#end if
+
+rm -f /etc/network/interfaces
+touch /etc/network/interfaces
+
+cat >> /etc/network/interfaces << EOF
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+auto eth0
+iface eth0 inet dhcp
+# This is an autoconfigured IPv6 interface
+iface eth0 inet6 auto
+EOF
+
+{% if resolvconf|length > 0 %}
+rm -f /etc/resolv.conf
+touch /etc/resolv.conf
+
+cat >> /etc/resolv.conf << EOF
+{% for line in resolvconf %}
+{{ line }}
+{% endfor %}
+EOF
+
+cat >> /etc/resolvconf/resolv.conf.d/base << EOF
+{% for line in resolvconf %}
+{{ line }}
+{% endfor %}
+EOF
+{% endif %}