Back to the main page

Reinstall OCI instance from Cobbler using Koan

Introduction

Koan stands for "kickstart-over-a-network" and is a client-side helper program for use with Cobbler. Koan allows network provisioning of new a VM and re-installation of an existing system.

OCI instance

In this example, create OCI instance (OL7.5). Install koan, v2.8.3.

Console connection

Create console connection (serial console) for OCI instance, can be done via web. Attach public ssh key. Start serial console, OCI console will provide this command (use "-i key" in both ssh commands)

# ssh -i id_rsa \
  -o ProxyCommand='ssh -i id_rsa-o2c -W %h:%p -p 443 ocid1.instanceconsoleconnection.oc1.iad.abuwcl--uaoq@instance-console.us-ashburn-1.oraclecloud.com' \
  ocid1.instance.oc1.iad.abuw--gzflq

Oracle Linux Server 7.5
Kernel 4.14.35-1818.2.1.el7uek.x86_64 on an x86_64
oci-instance login:

Cobbler server

To learn more about Cobbler server (from OCI instance), by using koan command.

List distros


# koan --server=cobbler-admin.dom.com --list=distros

- looking for Cobbler at http://cobbler-admin.dom.com:80/cobbler_api
OL-R6-U4-x86_64
OL-R6-U9-x86_64
OL-R6-LATEST-x86_64
OVS-3.3.2-1077-x86_64

List profiles


# koan --server=cobbler-admin.dom.com --list=profiles

- looking for Cobbler at http://cobbler-admin.dom.com:80/cobbler_api
OL-R6-U4-x86_64
ATT_OL6.10-x86_64
OL-R6-U9-x86_64
zd74
OVS-3.4.2-1384-x86_64

Get profile details


# koan --server=cobbler-admin.dom.com  --display --profile=ATT_OL6.9-x86_64

- looking for Cobbler at http://cobbler-admin.dom.com:80/cobbler_api
- reading URL: http://cobbler-admin.dom.com/cblr/svc/op/ks/profile/ATT_OL6.9-x86_64
install_tree: http://10.x.x.x/cobbler/links/OL-R6-U9-x86_64
                name  : ATT_OL6.9-x86_64
              distro  : OL-R6-U9-x86_64
           kickstart  : http://10.x.x.x/cblr/svc/op/ks/profile/ATT_OL6.9-x86_64
             ks_meta  : tree=http://@@http_server@@/cblr/links/OL-R6-U9-x86_64
        install_tree  : http://10.x.x.x/cobbler/links/OL-R6-U9-x86_64
              kernel  : /var/www/cobbler/ks_mirror/OL-R6-U9-x86_64/images/pxeboot/vmlinuz
              initrd  : /var/www/cobbler/ks_mirror/OL-R6-U9-x86_64/images/pxeboot/initrd.img
      kernel_options  : ks=http://10.x.x.x/cblr/svc/op/ks/profile/ATT_OL6.9-x86_64 ...
               repos  :
            virt_ram  : 512
    virt_disk_driver  : raw
           virt_type  : xenpv
           virt_path  :
      virt_auto_boot  : 1

Re-install

koan

Use koan to specify what Cobbler's profile to be used for re-installation. Let's re-install OCI instance to be OL7.2

# koan --server=cobbler-admin.dom.com --replace-self --profile=ATT_OL7.2-x86_64

- looking for Cobbler at http://cobbler-admin.dom.com:80/cobbler_api
- reading URL: http://cobbler-admin.dom.com/cblr/svc/op/ks/profile/ATT_OL7.2-x86_64
install_tree: http://10.x.x.x/cobbler/links/OL-R7-U2-x86_64
downloading initrd initrd.img to /boot/initrd.img_koan
url=http://10.x.x.x/cobbler/images/OL-R7-U2-x86_64/initrd.img
- reading URL: http://10.x.x.x/cobbler/images/OL-R7-U2-x86_64/initrd.img
downloading kernel vmlinuz to /boot/vmlinuz_koan
url=http://10.x.x.x/cobbler/images/OL-R7-U2-x86_64/vmlinuz
- reading URL: http://10.x.x.x/cobbler/images/OL-R7-U2-x86_64/vmlinuz
- ['/sbin/grubby', '--add-kernel', '/boot/vmlinuz_koan', '--initrd', '/boot/initrd.img_koan', '--args', 
   '"ksdevice=link lang= console=ttyS0,9600 asknetwork text ks=http://10.x.x.x/cblr/svc/op/ks/profile/ATT_OL7.2-x86_64 
   ks=http://cobbler-admin.dom.com/cblr/svc/op/ks/profile/ATT_OL7.2-x86_64 "', '--copy-default', '--make-default', '--title=kick1538180544']
- ['/sbin/grubby', '--update-kernel', '/boot/vmlinuz_koan', '--remove-args=root']
- reboot to apply changes
Reboot OCI instance to start re-install. Watch the serial console.

Boot menu

Upon reboot, see the boot menu (on serial console), the first option is what koan provided in the previous output, that starts network re-install.

  1538180544
  Oracle Linux Server 7.5, with Linux 3.10.0-862.11.6.el7.x86_64
  Oracle Linux Server 7.5, with Unbreakable Enterprise Kernel 4.14.35-1818>
  Oracle Linux Server (3.10.0-862.el7.x86_64 with Linux) 7.5
  Oracle Linux Server (0-rescue-4601ef702ea54260b6cff15921d76d14 with Linu>
Follow the install process, in this example attended installation was selected.

Login

Once installation is completed, see the login menu.



Login into your re-installed OCI instance.

Oracle Linux Server 7.2
Kernel 3.8.13-98.7.1.el7uek.x86_64 on an x86_64
ca-oci-zdudic login: root
Password:

[root@ca-oci-zdudic ~]# ip addr s
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens3:  mtu 9000 qdisc mq state UP qlen 1000
    link/ether 02:00:17:00:cb:bf brd ff:ff:ff:ff:ff:ff
    inet 100.102.106.27/23 brd 100.102.107.255 scope global ens3
    inet6 fe80::17ff:fe00:cbbf/64 scope link
       valid_lft forever preferred_lft forever

[root@ca-oci-zdudic ~]# cat /etc/oracle-release
Oracle Linux Server release 7.2


Back to the main page