Documentation ¶
Index ¶
- Constants
- type AnsiblePlaybookCmd
- type AnsiblePlaybookOptions
- func (o *AnsiblePlaybookOptions) AddExtraVar(name string, value interface{}) error
- func (o *AnsiblePlaybookOptions) AddExtraVarsFile(file string) error
- func (o *AnsiblePlaybookOptions) AddVaultedExtraVar(vaulter Vaulter, name string, value string) error
- func (o *AnsiblePlaybookOptions) GenerateCommandOptions() ([]string, error)
- func (o *AnsiblePlaybookOptions) String() string
- type AnsiblePlaybookOptionsFunc
- type Vaulter
Constants ¶
const ( // DefaultAnsiblePlaybookBinary is the ansible-playbook binary file default value DefaultAnsiblePlaybookBinary = "ansible-playbook" // AskVaultPasswordFlag ask for vault password AskVaultPasswordFlag = "--ask-vault-password" // CheckFlag don't make any changes; instead, try to predict some of the changes that may occur CheckFlag = "--check" // DiffFlag when changing (small) files and templates, show the differences in those files; works great with --check DiffFlag = "--diff" // ExtraVarsFlag is the extra variables flag for ansible-playbook ExtraVarsFlag = "--extra-vars" // FlushCacheFlag is the flush cache flag for ansible-playbook FlushCacheFlag = "--flush-cache" // ForceHandlersFlag run handlers even if a task fails ForceHandlersFlag = "--force-handlers" // ForksFlag specify number of parallel processes to use (default=50) ForksFlag = "--forks" // InventoryFlag is the inventory flag for ansible-playbook InventoryFlag = "--inventory" // LimitFlag is the limit flag for ansible-playbook LimitFlag = "--limit" // ListHostsFlag is the list hosts flag for ansible-playbook ListHostsFlag = "--list-hosts" // ListTagsFlag is the list tags flag for ansible-playbook ListTagsFlag = "--list-tags" // ListTasksFlag is the list tasks flag for ansible-playbook ListTasksFlag = "--list-tasks" // ModulePathFlag repend colon-separated path(s) to module library (default=~/.ansible/plugins/modules:/usr/share/ansible/plugins/modules) ModulePathFlag = "--module-path" // SkipTagsFlag only run plays and tasks whose tags do not match these values SkipTagsFlag = "--skip-tags" // StartAtTaskFlag start the playbook at the task matching this name StartAtTaskFlag = "--start-at-task" // StepFlag one-step-at-a-time: confirm each task before running StepFlag = "--step" // SyntaxCheckFlag is the syntax check flag for ansible-playbook SyntaxCheckFlag = "--syntax-check" // TagsFlag is the tags flag for ansible-playbook TagsFlag = "--tags" // VaultIDFlag the vault identity to use VaultIDFlag = "--vault-id" // VaultPasswordFileFlag is the vault password file flag for ansible-playbook VaultPasswordFileFlag = "--vault-password-file" // VersionFlag show program's version number, config file location, configured module search path, module location, executable location and exit VersionFlag = "--version" // VerboseFlag verbose mode enabled VerboseFlag = "-vvvv" // VerboseVFlag verbose with -v is enabled VerboseVFlag = "-v" // VerboseVVFlag verbose with -vv is enabled VerboseVVFlag = "-vv" // VerboseVFlag verbose with -vvv is enabled VerboseVVVFlag = "-vvv" // VerboseVFlag verbose with -vvvv is enabled VerboseVVVVFlag = "-vvvv" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnsiblePlaybookCmd ¶
type AnsiblePlaybookCmd struct { // Ansible binary file Binary string // Exec is the executor item Exec execute.Executor // Playbooks is the ansible's playbooks list to be used Playbooks []string // Options are the ansible's playbook options Options *AnsiblePlaybookOptions // ConnectionOptions are the ansible's playbook specific options for connection ConnectionOptions *options.AnsibleConnectionOptions // PrivilegeEscalationOptions are the ansible's playbook privilege escalation options PrivilegeEscalationOptions *options.AnsiblePrivilegeEscalationOptions // StdoutCallback defines which is the stdout callback method. By default is used 'default' method. Supported stdout method by go-ansible are: debug, default, dense, json, minimal, null, oneline, stderr, timer, yaml StdoutCallback string }
AnsiblePlaybookCmd object is the main object which defines the `ansible-playbook` command and how to execute it.
func (*AnsiblePlaybookCmd) Command ¶
func (p *AnsiblePlaybookCmd) Command() ([]string, error)
Command generate the ansible-playbook command which will be executed
func (*AnsiblePlaybookCmd) Run ¶
func (p *AnsiblePlaybookCmd) Run(ctx context.Context) error
Run method runs the ansible-playbook
func (*AnsiblePlaybookCmd) String ¶
func (p *AnsiblePlaybookCmd) String() string
String returns AnsiblePlaybookCmd as string
type AnsiblePlaybookOptions ¶
type AnsiblePlaybookOptions struct { // AskVaultPassword ask for vault password AskVaultPassword bool // Check don't make any changes; instead, try to predict some of the changes that may occur Check bool // Diff when changing (small) files and templates, show the differences in those files; works great with --check Diff bool // ExtraVars is a map of extra variables used on ansible-playbook execution ExtraVars map[string]interface{} // ExtraVarsFile is a list of files used to load extra-vars ExtraVarsFile []string // FlushCache is the flush cache flag for ansible-playbook FlushCache bool // ForceHandlers run handlers even if a task fails ForceHandlers bool // Forks specify number of parallel processes to use (default=50) Forks string // Inventory specify inventory host path Inventory string // Limit is selected hosts additional pattern Limit string // ListHosts outputs a list of matching hosts ListHosts bool // ListTags is the list tags flag for ansible-playbook ListTags bool // ListTasks is the list tasks flag for ansible-playbook ListTasks bool // ModulePath repend colon-separated path(s) to module library (default=~/.ansible/plugins/modules:/usr/share/ansible/plugins/modules) ModulePath string // SkipTags only run plays and tasks whose tags do not match these values SkipTags string // StartAtTask start the playbook at the task matching this name StartAtTask string // Step one-step-at-a-time: confirm each task before running Step bool // SyntaxCheck is the syntax check flag for ansible-playbook SyntaxCheck bool // Tags is the tags flag for ansible-playbook Tags string // VaultID the vault identity to use VaultID string // VaultPasswordFile path to the file holding vault decryption key VaultPasswordFile string // Verbose verbose mode enabled Verbose bool // Verbose verbose mode -v enabled VerboseV bool // Verbose verbose mode -vv enabled VerboseVV bool // Verbose verbose mode -vvv enabled VerboseVVV bool // Verbose verbose mode -vvvv enabled VerboseVVVV bool // Version show program's version number, config file location, configured module search path, module location, executable location and exit Version bool }
AnsiblePlaybookOptions object has those parameters described on `Options` section within ansible-playbook's man page, and which defines which should be the ansible-playbook execution behavior.
func (*AnsiblePlaybookOptions) AddExtraVar ¶
func (o *AnsiblePlaybookOptions) AddExtraVar(name string, value interface{}) error
AddExtraVar registers a new extra variable on ansible-playbook options item
func (*AnsiblePlaybookOptions) AddExtraVarsFile ¶ added in v1.1.3
func (o *AnsiblePlaybookOptions) AddExtraVarsFile(file string) error
AddExtraVarsFile adds an extra-vars file on ansible-playbook options item
func (*AnsiblePlaybookOptions) AddVaultedExtraVar ¶ added in v1.2.0
func (o *AnsiblePlaybookOptions) AddVaultedExtraVar(vaulter Vaulter, name string, value string) error
AddVaultedExtraVar registers a new extra variable on ansible-playbook options item vaulting its value
func (*AnsiblePlaybookOptions) GenerateCommandOptions ¶
func (o *AnsiblePlaybookOptions) GenerateCommandOptions() ([]string, error)
GenerateCommandOptions return a list of options flags to be used on ansible-playbook execution
func (*AnsiblePlaybookOptions) String ¶
func (o *AnsiblePlaybookOptions) String() string
String returns AnsiblePlaybookOptions as string
type AnsiblePlaybookOptionsFunc ¶
type AnsiblePlaybookOptionsFunc func(*AnsiblePlaybookCmd)
AnsiblePlaybookOptionsFunc is a function to set executor options