本文整理匯總了Golang中github.com/jiasir/playback/command.ExecuteWithOutput函數的典型用法代碼示例。如果您正苦於以下問題:Golang ExecuteWithOutput函數的具體用法?Golang ExecuteWithOutput怎麽用?Golang ExecuteWithOutput使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ExecuteWithOutput函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: AddOSD
// AddOSD add the Ceph OSDs.
// Only sopport sdb and sdc.
// The method takes the following commands of Playback:
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute01 disk=sdb partition=sdb1" -vvvv'
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute01 disk=sdc partition=sdc1" -vvvv'
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute02 disk=sdb partition=sdb1" -vvvv'
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute02 disk=sdc partition=sdc1" -vvvv'
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute03 disk=sdb partition=sdb1" -vvvv'
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute03 disk=sdc partition=sdc1" -vvvv'
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute04 disk=sdb partition=sdb1" -vvvv'
// playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute04 disk=sdc partition=sdc1" -vvvv'
// Only support two nodes for sdb and sdc currently.
func (vars ExtraVars) AddOSD() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[0], "disk=sdb", "partition=sdb1", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[0], "disk=sdc", "partition=sdc1", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[1], "disk=sdb", "partition=sdb1", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[1], "disk=sdc", "partition=sdc1", "-vvvv")
return nil
}
示例2: MariadbCluster
// MariadbCluster deploy MariaDB Cluster.
// The method takes the following commands of Playback:
// playback --ansible 'openstack_mariadb.yml --extra-vars "host=controller01 my_ip=192.169.151.19" -vvvv'
// playback --ansible 'openstack_mariadb.yml --extra-vars "host=controller02 my_ip=192.169.151.17" -vvvv'
// python keepalived.py
func (vars ExtraVars) MariadbCluster() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_mariadb.yml", "--extra-vars", "host="+vars.HostName, "my_ip="+vars.MyIP, "-vvvv")
if vars.HostName == "controller02" {
command.ExecuteWithOutput("python keepalived.py")
}
return nil
}
示例3: ConfigureStorageNetwork
// ConfigureStorageNetwork takes playback-nic to set up the storage network.
// Purge the configuration and set address to 192.169.151.19 for eth1 of host 192.169.150.19 as public interface:
// playback-nic --purge --public --host 192.169.150.19 --user ubuntu --address 192.169.151.19 --nic eth1 --netmask 255.255.255.0 --gateway 192.169.151.1 --dns-nameservers "192.169.11.11 192.169.11.12"
//Setting address to 192.168.1.12 for eth2 of host 192.169.150.19 as private interface:
// playback-nic --private --host 192.169.150.19 --user ubuntu --address 192.168.1.12 --nic eth2 --netmask 255.255.255.0
func (vars ExtraVars) ConfigureStorageNetwork() error {
if vars.PlaybackNic.Purge {
if vars.PlaybackNic.Public {
command.ExecuteWithOutput("playback-nic", "--purge", "--public", "--host", vars.PlaybackNic.Host, "--user", vars.PlaybackNic.User, "--address", vars.PlaybackNic.Address, "--nic", vars.PlaybackNic.NIC, "--netmask", vars.PlaybackNic.Netmask, "--gateway", vars.PlaybackNic.Gateway, "--dns-nameservers", vars.PlaybackNic.DNS)
}
}
if vars.PlaybackNic.Private {
command.ExecuteWithOutput("playback-nic", "--private", "--host", vars.PlaybackNic.Host, "--user", vars.PlaybackNic.Host, "--address", vars.PlaybackNic.Address, "--nic", vars.PlaybackNic.NIC, "--netmask", vars.PlaybackNic.Netmask)
}
return nil
}
示例4: Run
// Run takes provision-api command.
func (p provision) Run(args []string) int {
// TODO: Refactor arg parse.
// TODO: Refactor exit status.
for _, arg := range args {
if arg == "start" {
command.ExecuteWithOutput("provision-api")
}
}
return 0
}
示例5: InitSwiftRings
// InitSwiftRings initial Swift rings.
// The method takes the following commands of Playback:
// playback --ansible 'openstack_swift_builder_file.yml -vvvv'
// playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.16 device_name=sdb1 device_weight=100" -vvvv'
// playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.16 device_name=sdc1 device_weight=100" -vvvv'
// playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.15 device_name=sdb1 device_weight=100" -vvvv'
// playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.15 device_name=sdc1 device_weight=100" -vvvv'
// playback --ansible 'openstack_swift_rebalance_ring.yml -vvvv'
func (vars ExtraVars) InitSwiftRings() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_builder_file.yml", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[0], "device_name=sdb1", "device_weight=100", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[0], "device_name=sdc1", "device_weight=100", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[1], "device_name=sdb1", "device_weight=100", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[1], "device_name=sdc1", "device_weight=100", "-vvvv")
command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_rebalance_ring.yml", "-vvvv")
return nil
}
示例6: main
func main() {
var interfaces = new(common.Interfaces)
// ansible puts module args to a file wich is os.Args[1] on remote server
data, err := ioutil.ReadFile(os.Args[1])
if err != nil {
panic(err)
}
args := strings.Split(string(data), " ") // [k=v k=v k=v]
// arg is k=v
for _, arg := range args {
if strings.Contains(arg, "=") {
k := strings.Split(arg, "=")[0] // the key
v := strings.Split(arg, "=")[1] // the value
// set the k v to struct
interfaces.InitInterfaces(k, v)
}
}
interfaces.Changed = true
// use interfaces.d instead of /etc/network/interfaces
interfaces.PurgeMainConf()
// setup internal nic
interfaces.SetInternalNIC()
if interfaces.ExternalNIC != "" {
// setup external nic
interfaces.SetExternalNIC()
}
if interfaces.Restart {
// restart the system for take effect
command.ExecuteWithOutput("sudo", "shuwdown", "-r", "+1", "FastForward takes reboot")
}
output, err := json.Marshal(*interfaces) //produce JSON from interfaces struct
if err != nil {
fmt.Println(err)
} else {
fmt.Printf("%s", output)
}
}
示例7: SyncCephKey
// SyncCephKey copy the Ceph keys to nodes.
// Copy the configuration file and admin key to your admin node and your Ceph Nodes so that you can use the ceph CLI without having to specify the monitor address and ceph.client.admin.keyring each time you execute a command.
// The method takes the following commands of Playback:
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=controller01" -vvvv'
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=controller02" -vvvv'
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute01" -vvvv'
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute02" -vvvv'
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute03" -vvvv'
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute04" -vvvv'
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute05" -vvvv'
// playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute06" -vvvv'
func (vars ExtraVars) SyncCephKey() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_copy_keys.yml", "--extra-vars", "node="+vars.Node, "-vvvv")
return nil
}
示例8: CephUserPool
// CephUserPool creates the cinder ceph user and pool name.
// The method takes the following command of Playback:
// playback --ansible 'openstack_ceph_cinder_pool_user.yml -vvvv'
func (vars ExtraVars) CephUserPool() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_cinder_pool_user.yml", "-vvvv")
return nil
}
示例9: LBOptimize
// LBOptimize optimizing load balancer.
// the method takes the floowing command of Playback:
// python patch-limits.py
func (vars ExtraVars) LBOptimize() error {
command.ExecuteWithOutput("python patch-limits.py")
return nil
}
示例10: AddCephMon
// AddCephMon add the Ceph monitors.
// The method takes the following command of Playback:
// playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute01" -vvvv'
// playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute02" -vvvv'
// playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute03" -vvvv'
// playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute04" -vvvv'
func (vars ExtraVars) AddCephMon() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_mon.yml", "--extra-vars", "node="+vars.Node, "-vvvv")
return nil
}
示例11: CephClient
// CephClient deploy the Ceph client.
// The method takes the following commands of Playback:
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=controller01" -vvvv'
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=controller02" -vvvv'
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute01" -vvvv'
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute02" -vvvv'
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute03" -vvvv'
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute04" -vvvv'
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute05" -vvvv'
// playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute06" -vvvv'
func (vars ExtraVars) CephClient() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_client.yml", "--extra-vars", "client="+vars.ClientName, "-vvvv")
return nil
}
示例12: GetCephKey
// GetCephKey add Ceph initial monitors and gather the keys.
// The method takes the following command of Playback:
// playback --ansible 'openstack_ceph_gather_keys.yml -vvvv'
func (vars ExtraVars) GetCephKey() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_gather_keys.yml", "-vvvv")
return nil
}
示例13: Designate
// Designate deploy DNS as a Service.
// The method takes the following command of Playback:
// playback --ansible openstack_dns.yml -vvvv
// Execute on controller01:
// bash /mnt/designate-keystone-setup
// nohup designate-central > /dev/null 2>&1 &
// nohup designate-api > /dev/null 2>&1 &
func (vars ExtraVars) Designate() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_dns.yml", "-vvvv")
return nil
}
示例14: PrepareBasicEnvirionment
// PrepareBasicEnvirionment prepares OpenStack basic environment.
// The method takes the following command of Playback:
// playback --ansible 'openstack_basic_environment.yml -vvvv'
func (vars ExtraVars) PrepareBasicEnvirionment() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_basic_environment.yml", "-vvvv")
return nil
}
示例15: Dashboard
// Dashboard deploy Horizon.
// The method takes the following command of Playback:
// playback --ansible 'openstack_horizon.yml -vvvv'
func (vars ExtraVars) Dashboard() error {
command.ExecuteWithOutput("playback", "--ansible", "openstack_horizon.yml", "-vvvv")
return nil
}