cmd

package
v0.0.0-...-0c6362b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Copyright © 2022 Kaleb Hawkins <Kaleb_Hawkins@outlook.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Kaleb Hawkins <Kaleb_Hawkins@outlook.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Kaleb Hawkins <KalebHawkins@outlook.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2022 Kaleb Hawkins <KalebHawkins@outlook.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func RunPlaybook

func RunPlaybook()

Types

type AHVCluster

type AHVCluster struct {
	URL                  string `yaml:"url"`
	Username             string `yaml:"username"`
	Password             string `yaml:"password"`
	Template             string `yaml:"template"`
	NetworkUUID          string `yaml:"networkUUID"`
	StorageContainerUUID string `yaml:"storageContainerUUID"`
	VolumeGroup          string `yaml:"volumeGroup"`
	Insecure             bool   `yaml:"insecure"`
	URI                  string
}

func (*AHVCluster) AttachVMToVolumeGroup

func (ahv *AHVCluster) AttachVMToVolumeGroup(vmUUID, vgUUID string) (string, int)

AttachVMToVolumeGroup attaches a VM to a volume group.

func (*AHVCluster) CloneVM

func (ahv *AHVCluster) CloneVM(vm *AHVVirtualMachine, vmUuid string) (string, int)

CloneVM clones the source VM using POST v2 call to the /clone endpoint requires vm uuid , clone api endpoint and clone Name

func (*AHVCluster) CreateVolumeGroup

func (ahv *AHVCluster) CreateVolumeGroup() (string, int)

CreateVolumeGroup creates a volume group given a VG Name and storageContainer ID.

func (*AHVCluster) Deploy

func (ahv *AHVCluster) Deploy()

func (*AHVCluster) GenerateVMClonePayload

func (ahv *AHVCluster) GenerateVMClonePayload(vm *AHVVirtualMachine) []byte

GenerateVMClonePayload payload JSON data for cloning the VM; takes clone Name as input Requires Network UUID of the network the Clone will be in Network UUID can be obtained usinag acli net.list on the CVM

func (*AHVCluster) GenerateVolumeGroupPayload

func (ahv *AHVCluster) GenerateVolumeGroupPayload() []byte

GenerateVolumeGroupPayload generate payload JSON data for creating a VolumeGroup

func (*AHVCluster) Get

func (ahv *AHVCluster) Get(Obj string) (string, error)

func (*AHVCluster) GetVMUUID

func (ahv *AHVCluster) GetVMUUID(vmName string) (string, error)

GetVMUUID gets uuid of the VM which is to be cloned

func (*AHVCluster) GetVolumeGroupUUID

func (ahv *AHVCluster) GetVolumeGroupUUID(vgName string) (string, error)

GetVolumeGroupUUID gets uuid of volume group

func (*AHVCluster) Post

func (ahv *AHVCluster) Post(Obj string, jsonByteData []byte) (string, int, error)

func (*AHVCluster) SanitizeURL

func (ahv *AHVCluster) SanitizeURL()

SanitizeURL appends a trailing / to the end of the URL if there isn't one already present.

type AHVVirtualMachine

type AHVVirtualMachine struct {
	Name      string `yaml:"name"`
	Cpu       string `yaml:"cpu"`
	MemoryMB  string `yaml:"memoryMB"`
	Ipaddress string `yaml:"ipaddress"`
	Netmask   string `yaml:"netmask"`
	Gateway   string `yaml:"gateway"`
	CIDR      string `yaml:"cidr"`
}

type AnsibleVars

type AnsibleVars struct {
	RhelUsername           interface{} `yaml:"rhel_username"`
	RhelPassword           interface{} `yaml:"rhel_password"`
	RhelPoolIDs            []string    `yaml:"rhel_poolids"`
	DNSSuffixSearchList    []string    `yaml:"dns_suffix_search_list"`
	DomainController1      string      `yaml:"dc01"`
	DomainController2      string      `yaml:"dc02"`
	DNSServer1             string      `yaml:"dns_server1"`
	DNSServer2             string      `yaml:"dns_server2"`
	CrowdstrikeTag         string      `yaml:"crowdstrikeTag"`
	CrowdstrikeCustomerID  string      `yaml:"crowdstrikeCustomerID"`
	QualysCustomerID       string      `yaml:"qualysCustomerID"`
	QualysActivationID     string      `yaml:"qualysActivationID"`
	ClusterName            string      `yaml:"clusterName"`
	ClusterPassword        string      `yaml:"clusterPassword"`
	ClusterPasswordHash    string      `yaml:"clusterPasswordHash"`
	VirtualIP              string      `yaml:"virtualIP"`
	VCenterServer          string      `yaml:"vcenterServer,omitempty"`
	VCenterServerShortName string      `yaml:"vcenterServerShortName,omitempty"`
	VCenterServiceAccount  string      `yaml:"vcenterServiceAccount,omitempty"`
	VCenterSAPassword      string      `yaml:"vcenterSAPassword,omitempty"`
	PrimaryNode            string      `yaml:"primaryNode"`
	SecondaryNode          string      `yaml:"secondaryNode"`
	PrimaryNodeIP          string      `yaml:"primaryNodeIP"`
	SecondaryNodeIP        string      `yaml:"secondaryNodeIP"`
	PrimaryNodeGateway     string      `yaml:"primaryNodeGateway"`
	SecondaryNodeGateway   string      `yaml:"secondaryNodeGateway"`
	PrimaryNodeCIDR        string      `yaml:"primaryNodeCIDR"`
	SecondaryNodeCIDR      string      `yaml:"secondaryNodeCIDR"`
	Platform               string      `yaml:"platform"`
	SplunkUsername         string      `yaml:"splunkUsername"`
	SplunkPassword         string      `yaml:"splunkPassword"`
	SplunkDeployServer     string      `yaml:"splunkDeployServer"`
	AnsibleHttpProxy       string      `yaml:"ansibleHttpProxy"`
	AnsibleHttpProxyPort   string      `yaml:"ansibleHttpProxyPort"`
	AnsibleHttpsProxy      string      `yaml:"ansibleHttpsProxy"`
	AnsibleHttpsProxyPort  string      `yaml:"ansibleHttpsProxyPort"`
}

type Disk

type Disk struct {
	Size      string `yaml:"size"`
	Datastore string `yaml:"datastore"`
}

type VCenterClient

type VCenterClient struct {
	URL          string `yaml:"url"`
	Username     string `yaml:"username"`
	Password     string `yaml:"password"`
	Insecure     string `yaml:"insecure"`
	Datacenter   string `yaml:"datacenter"`
	ResourcePool string `yaml:"resourcePool"`
	Network      string `yaml:"network"`
	Datastore    string `yaml:"datastore"`
	Folder       string `yaml:"folder"`
	Template     string `yaml:"template"`
	Cluster      string `yaml:"cluster"`
}

func (*VCenterClient) CreateFolder

func (vc *VCenterClient) CreateFolder(name string) error

func (*VCenterClient) CreateSSOUser

func (vc *VCenterClient) CreateSSOUser(name, password, description string) error

func (*VCenterClient) Deploy

func (vc *VCenterClient) Deploy()

func (*VCenterClient) SSOUserExists

func (vc *VCenterClient) SSOUserExists(name string) bool

func (*VCenterClient) SetPermissions

func (vc *VCenterClient) SetPermissions(username, role, resourcePath string) error

func (*VCenterClient) SetupEnv

func (vc *VCenterClient) SetupEnv() error

type VirtualMachine

type VirtualMachine struct {
	Name       string `yaml:"name"`
	Ipaddress  string `yaml:"ipaddress"`
	Cpu        string `yaml:"cpu"`
	MemoryMB   string `yaml:"memoryMB"`
	Annotation string `yaml:"annotation"`
	Netmask    string `yaml:"netmask"`
	Gateway    string `yaml:"gateway"`
	Cidr       string `yaml:"cidr"`
	Datastore  string `yaml:"datastore"`
}

func (*VirtualMachine) AddSCSI

func (vm *VirtualMachine) AddSCSI(sharing string) error

func (*VirtualMachine) AttachDisk

func (vm *VirtualMachine) AttachDisk(name, controller, datastore string) error

func (*VirtualMachine) ConfigureNetwork

func (vm *VirtualMachine) ConfigureNetwork(dnsServers, dnsSuffix []string) error

func (*VirtualMachine) Create

func (vm *VirtualMachine) Create(vc *VCenterClient) error

func (*VirtualMachine) CreateDisk

func (vm *VirtualMachine) CreateDisk(name, size, controller, datastore string) error

func (*VirtualMachine) Exists

func (vm *VirtualMachine) Exists() bool

func (*VirtualMachine) GetSCSIDevices

func (vm *VirtualMachine) GetSCSIDevices() []string

func (*VirtualMachine) PowerOn

func (vm *VirtualMachine) PowerOn() error

func (*VirtualMachine) StartConnected

func (vm *VirtualMachine) StartConnected() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL