lop-devops / LOPOsinstall

GNU General Public License v2.0
2 stars 5 forks source link

The install protocol support is added. #10

Closed priyama2 closed 2 months ago

priyama2 commented 3 months ago

Hereby we can use http,ftp,nfs as argument to the installation

abdhaleegit commented 3 months ago

looks like one unwanted config_parser.py is added..please remove it

priyama2 commented 3 months ago

Syntax:

usage: installvm.py [-h] --host-ip HOST_IP --host-name HOST_NAME --host-gw
                    HOST_GW [--host-netmask HOST_NETMASK] --host-mac HOST_MAC
                    --host-disk HOST_DISK [--boot-disk BOOT_DISK]
                    [--multipathsetup MULTIPATHSETUP]
                    [--kernel-params KERNEL_PARAMS]
                    [--host-password HOST_PASSWORD] --lpar-hmc LPAR_HMC
                    --lpar-managed-system LPAR_MANAGED_SYSTEM
                    --lpar-partition-name LPAR_PARTITION_NAME
                    [--hmc-userid HMC_USERID] [--hmc-password HMC_PASSWORD]
                    [--hmc-profile HMC_PROFILE] [--ksargs KSARGS]
                    [--showcleanup SHOWCLEANUP] --distro DISTRO
                    [--set-boot-order SET_BOOT_ORDER] --ssl-server SSL_SERVER
                    [--install-protocol INSTALL_PROTOCOL_TYPE]

optional arguments:
  -h, --help            show this help message and exit
  --distro DISTRO       distro to be installed ex: rhel_7.4le_alpa,
                        sles_11sp3_beta
  --set-boot-order SET_BOOT_ORDER
                        yes/True to set the boot disk order
  --ssl-server SSL_SERVER  SSL certificate for the server domain to be created in LPAR

Host Specific Information for Installation:

  --host-ip HOST_IP     Host IP address
  --host-name HOST_NAME
                        Host FQDN
  --host-gw HOST_GW     Host Gateway IP
  --host-netmask HOST_NETMASK
                        Host network subnetmask
  --host-mac HOST_MAC   Host MAC address
  --host-disk HOST_DISK
                        Host disk(s) by-id to install ex: /dev/disk/by-
                        id/<disk>
  --boot-disk BOOT_DISK
                        boot disk ID from VIOS to set order ex:
                        U9080.M9S.78264B8-V1-C101-T1-L8100000000000000
  --multipathsetup MULTIPATHSETUP
                        Host disk having multipath setup
  --kernel-params KERNEL_PARAMS
                        append addon kernel parameters
  --host-password HOST_PASSWORD
                        system password

Managed System Details:

  --lpar-hmc LPAR_HMC   HMC Name or IP
  --lpar-managed-system LPAR_MANAGED_SYSTEM
                        LPAR Managed system name
  --lpar-partition-name LPAR_PARTITION_NAME
                        LPAR Partition Name
  --hmc-userid HMC_USERID
                        HMC userid
  --hmc-password HMC_PASSWORD
                        HMC password
  --hmc-profile HMC_PROFILE
                        HMC Profile Name
  --ksargs KSARGS       Additional Kick Start option
  --showcleanup SHOWCLEANUP

Example :
python installvm.py --host-ip <host ip> --host-name <host name > --host-gw <system gateway> 
--host-netmask <netmask> --host-mac <mac> --lpar-hmc <hmc where lpar hosted> 
--lpar-managed-system <managed system name> --lpar-partition-name <partition name> 
--distro <build name (hosted in /repo/crlt path)> --host-disk=<disk name> --hmc-profile <lpar profile> --install-protocol <protocol-type>

Examples: install protocol: nfs python3 installvm.py --host-ip xx.xx.xx.xx --host-name abc --host-gw xx.xx.xx.xx --host-netmask xx.xx.xx.xx --host-mac ab:cd:11:11:11 --lpar-hmc HMC --lpar-managed-system abc --lpar-partition-name abc1 --distro rhel_9.3 --host-disk=0235b1 --hmc-profile default_profile --hmc-userid xyz --hmc-password 111 --host-password 111 --kernel-params None --install-protocol nfs ks file:

[root@powerkvm1-lp1 rhel]# cat rhel-ab:cd:11:11:11.ks
%pre
%end
url --url=nfs://xx.xx.xx.xx:1/crtl/repo/rhel/9.3le
text
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
rootpw --plaintext 111
skipx
timezone Asia/Kolkata --isUtc
zerombr
clearpart --all --initlabel --drives=/dev/disk/by-id/0235b1
bootloader   --location=mbr --boot-drive=/dev/disk/by-id/0235b1
ignoredisk --only-use=/dev/disk/by-id/dm-uuid-mpath-0235b1
autopart --type=lvm --fstype=ext4
services --enabled=NetworkManager,sshd
reboot
%packages
@core
kexec-tools
device-mapper-multipath
%end
%post
sed -i 's/#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;service sshd restart;multipath -t >/etc/multipath.conf;service multipathd start
%end

http: python3 installvm.py --host-ip xx.xx.xx.xx --host-name abc --host-gw xx.xx.xx.xx --host-netmask xx.xx.xx.xx --host-mac ab:cd:11:11:11 --lpar-hmc HMC --lpar-managed-system abc --lpar-partition-name abc1 --distro rhel_9.3 --host-disk=0235b1 --hmc-profile default_profile --hmc-userid xyz --hmc-password 111 --host-password 111 --kernel-params None --install-protocol http

ksfile:

[root@powerkvm1-lp1 rhel]# cat rhel-ab:cd:11:11:11.ks
%pre
%end
url --url=http://xx.xx.xx.xx:1/crtl/repo/rhel/9.3le
text
keyboard --vckeymap=us --xlayouts='us'
lang en_US.UTF-8
rootpw --plaintext 111
skipx
timezone Asia/Kolkata --isUtc
zerombr
clearpart --all --initlabel --drives=/dev/disk/by-id/0235b1
bootloader   --location=mbr --boot-drive=/dev/disk/by-id/0235b1
ignoredisk --only-use=/dev/disk/by-id/dm-uuid-mpath-0235b1
autopart --type=lvm --fstype=ext4
services --enabled=NetworkManager,sshd
reboot
%packages
@core
kexec-tools
device-mapper-multipath
%end
%post
sed -i 's/#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config;service sshd restart;multipath -t >/etc/multipath.conf;service multipathd start
%end
PraveenPenguin commented 2 months ago

@priyama2 please wrap changes in commits as something like below and squashed other commit, and we are good to go 1- Add nfs support 2- Add FTP support

priyama2 commented 2 months ago

Closing since new PR will be tracked for further process