mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
70 lines
2.4 KiB
Go
70 lines
2.4 KiB
Go
/*
|
|
Copyright 2023 The KubeSphere Authors.
|
|
|
|
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.
|
|
*/
|
|
|
|
package v1
|
|
|
|
import "gopkg.in/yaml.v3"
|
|
|
|
// Base defined in project.
|
|
type Base struct {
|
|
Name string `yaml:"name,omitempty"`
|
|
|
|
// connection/transport
|
|
Connection string `yaml:"connection,omitempty"`
|
|
Port int `yaml:"port,omitempty"`
|
|
RemoteUser string `yaml:"remote_user,omitempty"`
|
|
|
|
// variables
|
|
Vars Vars `yaml:"vars,omitempty"`
|
|
|
|
// module default params
|
|
//ModuleDefaults []map[string]map[string]any `yaml:"module_defaults,omitempty"`
|
|
|
|
// flags and misc. settings
|
|
Environment []map[string]string `yaml:"environment,omitempty"`
|
|
NoLog bool `yaml:"no_log,omitempty"`
|
|
RunOnce bool `yaml:"run_once,omitempty"`
|
|
IgnoreErrors *bool `yaml:"ignore_errors,omitempty"`
|
|
CheckMode bool `yaml:"check_mode,omitempty"`
|
|
Diff bool `yaml:"diff,omitempty"`
|
|
AnyErrorsFatal bool `yaml:"any_errors_fatal,omitempty"`
|
|
Throttle int `yaml:"throttle,omitempty"`
|
|
Timeout int `yaml:"timeout,omitempty"`
|
|
|
|
// Debugger invoke a debugger on tasks
|
|
Debugger string `yaml:"debugger,omitempty"`
|
|
|
|
// privilege escalation
|
|
Become bool `yaml:"become,omitempty"`
|
|
BecomeMethod string `yaml:"become_method,omitempty"`
|
|
BecomeUser string `yaml:"become_user,omitempty"`
|
|
BecomeFlags string `yaml:"become_flags,omitempty"`
|
|
BecomeExe string `yaml:"become_exe,omitempty"`
|
|
}
|
|
|
|
// Vars is a custom type to hold a list of YAML nodes representing variables.
|
|
// This allows for flexible unmarshalling of various YAML structures into Vars.
|
|
type Vars struct {
|
|
Nodes []yaml.Node
|
|
}
|
|
|
|
// UnmarshalYAML implements the yaml.Unmarshaler interface for Vars.
|
|
// It appends the unmarshalled YAML node to the Vars.Nodes slice.
|
|
func (v *Vars) UnmarshalYAML(node *yaml.Node) error {
|
|
v.Nodes = append(v.Nodes, *node)
|
|
return nil
|
|
}
|