Documentation ¶
Index ¶
- Constants
- type AdHocOptions
- type AdHocRunner
- type CommonOptions
- type ConnectionOptions
- type CronModuleArgs
- type FileModuleArgs
- type ModuleAdHocOptions
- type ModuleRunner
- type Play
- type PlaybookOptions
- type PlaybookRunner
- type PrivilegeOptions
- type Result
- type Runner
- type ScriptModuleArgs
- type ShellModuleArgs
- type SynchronizeModuleArgs
- type Task
- type UserModuleArgs
Constants ¶
View Source
const ( //Default Value DefaultAnsibleBin = "ansible" DefaultAnsiblePlaybookBin = "ansible-playbook" DefaultPattern = "all" DefaultForks = 10 DefaultPollInterval = 5 EmptyValue = "" ZeroValue = 0 FreeFormValue = "free_form" //Optional Arguments Flag Inventory = "-i" Check = "-C" ExtraVars = "-e" Forks = "-f" ModulePath = "-M" ModuleName = "-m" ModuleArgs = "-a" FlushCache = "--flush-cache" Tags = "-t" BackgroundSeconds = "-B" PollInterval = "-P" //Connection Options Flag PrivateKey = "--private-key" Timeout = "-T" Connection = "-c" RemoteUser = "-u" //Privilege Escalation Options Flag BecomeMethod = "--become-method" BecomeUser = "--become-user" Become = "-b" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdHocOptions ¶
type AdHocOptions struct { CommonOptions //host pattern Pattern string //module name to execute ModuleName string //module arguments string, map, or struct //if use map, free form parameter is actual parameter named 'free_form'. //but use string, free form parameter is no actual parameter ModuleArgs interface{} //async timeout, seconds BackgroundSeconds int //async poll interval, seconds PollInterval int }
type AdHocRunner ¶
type AdHocRunner struct { Bin string Options *AdHocOptions ConnectionOptions *ConnectionOptions PrivilegeOptions *PrivilegeOptions // contains filtered or unexported fields }
func NewAdHocRunner ¶
func NewAdHocRunner() *AdHocRunner
func (*AdHocRunner) CommandString ¶
func (r *AdHocRunner) CommandString() string
func (*AdHocRunner) Run ¶
func (r *AdHocRunner) Run() (*Result, error)
type CommonOptions ¶
type CommonOptions struct { //inventory hosts path or comma separated host list Inventory string //prepend colon-separated path(s) to module library ModulePath string //don't make any changes Check bool //set additional variables as k:v ExtraVars map[string]string //number of parallel processes Forks int }
type ConnectionOptions ¶
type CronModuleArgs ¶
type CronModuleArgs struct { //create a backup of the crontab before it is modified. Backup bool //if specified, uses this file instead of an individual user's crontab. CronFile string `map:"cron_file"` //description of a crontab entry or, if env is set, the name of environment variable. Name string //minute when the job should run Minute string //hour when the job should run Hour string //day of the month the job should run Day string //month of the year the job the job should run Month string //day of the week the job should run Weekday string //special time specification nickname.(choices: annually, daily, hourly, monthly, reboot, weekly, yearly) SpecialTime string `map:"special_time"` //the specific user whose crontab should be modified. User string //choices: absent, present State string //if the job should be disabled (commented out) in the crontab. Only has effect if `state=present'. Disabled bool //if set, manages a crontab's environment variable Env bool //if specified, the environment variable will be inserted after the declaration of specified environment variable. Insertafter string //if specified, the environment variable will be inserted before the declaration of specified environment variable. Insertbefore string //the command to execute or, if env is set, the value of environment variable. Job string }
type FileModuleArgs ¶
type FileModuleArgs struct { //filesystem links, if they exist, should be followed. Follow bool //force the creation of the symlinks Force bool //name of the user that should own the file/directory, as would be fed to `chown'. Owner string //name of the group that should own the file/directory, as would be fed to `chown'. Group string //the permissions the resulting file or directory should have, as would be fed to `chmod' Mode string //the dst file path Path string //recursively set the specified file attributes on directory contents. Recurse bool //the src file path Src string //the dst file state State string }
type ModuleAdHocOptions ¶
type ModuleAdHocOptions struct { CommonOptions //host pattern Pattern string //async timeout, seconds BackgroundSeconds int //async poll interval, seconds PollInterval int }
type ModuleRunner ¶
type ModuleRunner struct { Args interface{} Options *ModuleAdHocOptions ConnectionOptions *ConnectionOptions PrivilegeOptions *PrivilegeOptions // contains filtered or unexported fields }
func NewCronModule ¶
func NewCronModule() *ModuleRunner
func NewFileModule ¶
func NewFileModule() *ModuleRunner
func NewScriptModule ¶
func NewScriptModule() *ModuleRunner
func NewShellModule ¶
func NewShellModule() *ModuleRunner
func NewSynchronizeModule ¶
func NewSynchronizeModule() *ModuleRunner
func NewUserModule ¶
func NewUserModule() *ModuleRunner
func (*ModuleRunner) CommandString ¶
func (m *ModuleRunner) CommandString() string
func (*ModuleRunner) Run ¶
func (m *ModuleRunner) Run() (*Result, error)
type PlaybookOptions ¶
type PlaybookOptions struct { CommonOptions //playbook file path Playbook string //clear the fact cache for every host in inventory FlushCache bool //only run plays and tasks tagged with these values Tags string }
type PlaybookRunner ¶
type PlaybookRunner struct { Bin string Options *PlaybookOptions ConnectionOptions *ConnectionOptions PrivilegeOptions *PrivilegeOptions // contains filtered or unexported fields }
func NewPlaybookRunner ¶
func NewPlaybookRunner() *PlaybookRunner
func (*PlaybookRunner) CommandString ¶
func (r *PlaybookRunner) CommandString() string
func (*PlaybookRunner) Run ¶
func (r *PlaybookRunner) Run() (*Result, error)
type PrivilegeOptions ¶
type Result ¶
type Result struct { CustomStats map[string]interface{} `json:"custom_stats"` GlobalCustomStats map[string]interface{} `json:"global_custom_stats"` Plays []*Play `json:"plays"` Summary map[string]interface{} `json:"stats"` }
ansible running results
type ScriptModuleArgs ¶
type ShellModuleArgs ¶
type SynchronizeModuleArgs ¶
type SynchronizeModuleArgs struct { //mirrors the rsync archive flag, enables recursive, links, perms, times, owner, group flags and -D. Archive bool Checksum bool //compress file data during the transfer. Compress bool //copy symlinks as the item that they point to (the referent) is copied, rather than the symlink. CopyLinks bool `map:"copy_links"` //delete files that don't exist. Delete bool //path on the source host that will be synchronized to the destination. Src string //path on the destination host that will be synchronized from the source. Dest string //port number for ssh on the destination host. DestPort int `map:"dest_port"` //transfer directories without recursing. Dirs bool //copy symlinks as symlinks. Link bool //specify the direction of the synchronization. (choices: pull, push) Mode string //preserve group. Group bool //preserve owner. Owner bool //preserve perms. Perms bool //specify the private key to use for SSH-based rsync connections (e.g. `~/.ssh/id_rsa'). PrivateKey string `map:"private_key"` //recurse into directories. Recursive bool //specify a `--timeout' for the rsync command in seconds. RsyncTimeout int `map:"rsync_timeout"` //preserve modification times. Times bool //put user@ for the remote paths. SetRemoteUser bool `map:"set_remote_user"` //use the ssh_args specified in ansible.cfg. UseSSHArgs bool `map:"use_ssh_args"` //verify destination host key. VerifyHost bool `map:"verify_host"` }
type UserModuleArgs ¶
type UserModuleArgs struct { //name of the user to create, remove or modify. Name string //append user to groups,if false,remove them from all other groups. Append bool //description of user account Comment string //create user home directory CreateHome bool `map:"create_home"` Force bool //user's primary group Group string //list of groups user will be added to,separate by commaparated Groups string //user home directory Home string //remove directories, same as `userdel --remove' Remove bool //user's shell Shell string State string //UID Uid int }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.