Last updated on Monday 28th of February 2022 08:52:48 PM ©XSIDirector Man Page, ©VMWare ©ESXi Farm ManagementCentralized ©ESXi Farm Management for ©XSIBackup-DC![]() Manage groups of ©ESXi hosts from a centralized command line tool. ©XSIDirector allows to deploy ©XSIBackup-DC software to any number of servers, manage keys and licensing per server groups, run any command in all servers in a group, copy files to all servers, run backup & replica jobs and much more. Its use is based in keys and hosts lists. You can grant access to any host group by means of one or more RSA keys, since you have configured access for a given key, you can run software installs license management, copy files or run any arbitrary command in all the hosts to simplify management of a vast number of ©ESXi boxes. InstallationTo install just unzip to any Linux host and assign execute permissions to xsi-cmd.
chmod 0755 xsi-cmd
Dependencies©XSIDirector depends on:sshpass OpenSSH client dialog A dependency check is run on every execution, you will be pointed out if any of the dependencies is missing and how to install it. An ©XSIDirector command looks like the following.
./xsi-cmd install=XSIBackup-DC_1.5.0.4.zip key=RSAkey1 hosts=group1 -y
The above command will install the package XSIBackup-DC_1.5.0.4.zip stored in the bin directory to all the hosts in the list group1 using the key RSAkey1 and will not prompt for confirmation by virtue of the -y argument. But before being able to run any command you need to first generate at least a key pair and prepare a hosts list. Server list formatThe server list files are semicolon delimited CSV files ending in line feed characters char(10) containing the following fields.
IP/FQDN;port;username;password;hostname;comment\n
Example
192.168.33.181;22;root;mypassword;prod01;Production server
192.168.33.190;22;root;mypassword;prod02 192.168.33.183;22;root;mypassword;srv70;ESXi 7.0.1 server 192.168.33.160;22;root;mypassword;srv60;ESXi 6.0 server 192.168.33.12;22;root;someotherpwd;somesrv 192.168.133.11;22;root;mypassword;othersrv;Other server 192.168.133.19;22;root;mypassword;mysrv1 192.168.133.18;22;root;mypassword;priv01;My private description 192.168.133.16;22;root;mypassword;other02;Some other server 192.168.233.125;22;root;yetanotherpwd;yeti01 You can have as many hosts files as you want in the <installation root>/csv folder ready to be invoked from the command line. RSA KeysThe RSA key pairs allow to authenticate to the different hosts in a group without the need to enter the password for each one of them.You can generate as many keys as you want, being the simplest scenario that one formed by a single RSA key that allows to authenticate to a single hosts file comprised of 'n' hosts. Generate a key pair To generate a key pair you just have to use the key-gen action (action or first argument).
./xsi-cmd key-gen
You will be asked to enter a name for the new key and to confirm. Once you are done, you will see a new key pair in the keys directory.
-rw------- 1 root root 1675 May 5 19:17 key1_RSA_xsi-deploy
-rw------- 1 root root 395 May 5 19:17 key1_RSA_xsi-deploy.pub The name of the key is the highlighted part before the first underscore character and it is the string you will have to manage to refer to each key. Each set of keys is comprised by a public key (.pub) and a private key. The public key is the one that will be exchanged with the remote host and will be added to the remote host/user authorized_keys file to allow transparent communication. Distribute the key pair to the remote hosts Before you have exchanged keys, the only way to authenticate with the remote hosts is the password, generally the root password. Thus, the first key exchange with a group of hosts will be made by means of the stored password. Once the key has been exchaged you will no longer need the password column, thus, you can just obfuscate it or remove it from the corresponding hosts group file. To distribute a public key to a group of hosts you use the keys argument, which allows three different values passed to it after an equal sign: add, delete and dry-run. - add: it will add the provided key to a list of hosts. Examples
./xsi-cmd keys=add key=key1 hosts=group1
./xsi-cmd keys=delete key=key1 hosts=group1 ./xsi-cmd keys=dry-run key=key1 hosts=group1 Run any remote GUI Once you have added some key to a group of hosts you can invoke any remote GUI in any host in a group of hosts.
./xsi-cmd gui key=key hosts=group1
![]() Run some command in a group of hosts The cmd action allows to run some command synchronously in a given group of hosts. The action is synchronous as it waits for the result of the command and prints out the result before moving to the following host in the file. It has three main working modes: 1/ Using one of the built-in commands.Running a built-in command. There are a number of built-in commands you can use to run common maintenance tasks: • setHostName Running a custom command.
./xsi-cmd cmd=date key=key1 hosts=group1
./xsi-cmd cmd=file:job-backup-running.sh ./xsi-cmd cmd=file:job-backup-all.sh The first command above will execute the date command to every host in group1 using RSA key key1. The second command will execute the bundled script job-backup-running.sh, which will install job 902 to every host which will backup all running VMs. The thrid command will backup all VMs whether they are running or not as job 901. Please, note that this bundled scripts are generic. They don't pretend to match your exact needs automatically. Tweak them to your needs or add your own ones. Take on account that this generic scripts will automatically choose a backup point based on the available space in each NFS datastore. If you don't have any NFS DS available they may not work. Just edit them and add your desired targets. Install software and keys The install action will allow to deploy the software and install license keys. It has three basic subcommands.
./xsi-cmd install=XSIBackup-DC_1.5.0.4.zip key=key1 hosts=group1 -y
./xsi-cmd install=request-keys ./xsi-cmd install=download-keys key=test1 hosts=test1 The first example above will install the package in the <install root>/bin directory to every host in group1 using key1 and it won't ask for confirmation. The second example will create the request.key files in every host, download them to the <install root>/keys/xsi/requests directory and optionally upload them to our license server. The third command will download the license.key files once they have been generated by us, install them to every ©ESXi host and verify that they are working right. In this last example we have set the key and hosts arguments, thus we won't be asked for a key name or hosts file. Run jobs or other scripts asynchronously The run action allows to launch scripts in some hosts list without waiting for them to finish. They are launched in the background in every host and a confirmation that the script was launched is printed out, then xsi-cmd will continue to the following host.
./xsi-cmd run=/scratch/XSI/XSIBackup-DC/etc/jobs/902 hosts=192.168.133.197
./xsi-cmd run=/scratch/XSI/XSIBackup-DC/etc/jobs/902 hosts=group1 key=key1 The first command above executes the 'backup all running VMs' job at host 192.168.133.197 and exits. The second command executes the same job at every host in the group1 file using the key1 key. Copy files to hosts The put action allows to copy files to every host in a list of hosts. One very typical case in which you will want to use this argument is to distribute some smtpsrvs.conf file to all hosts. You would first need to create that file at any of the hosts, copy it to the <install root>/files directory and run a put command like the one below.
./xsi-cmd put="files/smtpsrvs.conf" target="/scratch/XSI/XSIBackup-DC/etc/smtpsrvs.conf"
./xsi-cmd put="files/smtpsrvs.conf" target="/scratch/XSI/XSIBackup-DC/etc/smtpsrvs.conf" hosts=group1 key=key1 As always you can let the command prompt to ask you for the key and hosts file or pass them along the rest of the command. |
![]() |