Documentation
¶
Index ¶
Constants ¶
const ( // AnsiblePlaybookBin is the ansible-playbook binary file value AnsiblePlaybookBin = "ansible-playbook" // AskBecomePassFlag is ansble-playbook's ask for become user password flag AskBecomePassFlag = "--ask-become-pass" // AskPassFlag is ansble-playbook's ask for connection password flag AskPassFlag = "--ask-pass" // BecomeFlag is ansble-playbook's become flag BecomeFlag = "--become" // BecomeMethodFlag is ansble-playbook's become method flag BecomeMethodFlag = "--become-method" // BecomeUserFlag is ansble-playbook's become user flag BecomeUserFlag = "--become-user" // ConnectionFlag is the connection flag for ansible-playbook ConnectionFlag = "--connection" // ExtraVarsFlag is the extra variables flag for ansible-playbook ExtraVarsFlag = "--extra-vars" // FlushCacheFlag is the flush cache flag for ansible-playbook FlushCacheFlag = "--flush-cache" // 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" // PrivateKeyFlag is the private key file flag for ansible-playbook PrivateKeyFlag = "--private-key " // TagsFlag is the tags flag for ansible-playbook TagsFlag = "--tags" // SyntaxCheckFlag is the syntax check flag for ansible-playbook SyntaxCheckFlag = "--syntax-check" // TimeoutFlag is the timeout flag for ansible-playbook TimeoutFlag = "--timeout" // UserFlag is the user flag for ansible-playbook UserFlag = "--user" // VaultPasswordFileFlag is the vault password file flag for ansible-playbook VaultPasswordFileFlag = "--vault-password-file" // AnsibleForceColorEnv is the environment variable which forces color mode AnsibleForceColorEnv = "ANSIBLE_FORCE_COLOR" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnsiblePlaybookCmd ¶
type AnsiblePlaybookCmd struct { // Exec is the executor item Exec Executor // ExecPrefix is a text that is set at the beginning of each execution line ExecPrefix string // Playbook is the ansible's playbook name to be used Playbook string // Options are the ansible's playbook options Options *AnsiblePlaybookOptions // ConnectionOptions are the ansible's playbook specific options for connection ConnectionOptions *AnsiblePlaybookConnectionOptions // PrivilegeEscalationOptions are the ansible's playbook privilage escalation options PrivilegeEscalationOptions *AnsiblePlaybookPrivilegeEscalationOptions // Writer manages the output Writer io.Writer }
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() error
Run method runs the ansible-playbook
type AnsiblePlaybookConnectionOptions ¶
type AnsiblePlaybookConnectionOptions struct { // AskPass defines whether user's password should be asked to connect to host AskPass bool // Connection is the type of connection used by ansible-playbook Connection string // PrivateKey is the user's private key file used to connect to a host PrivateKey string // Timeout is the connection timeout on ansible-playbook. Take care because Timeout is defined ad string Timeout string // User is the user to use to connect to a host User string }
AnsiblePlaybookConnectionOptions object has those parameters described on `Connections Options` section within ansible-playbook's man page, and which defines how to connect to hosts.
func (*AnsiblePlaybookConnectionOptions) GenerateCommandConnectionOptions ¶
func (o *AnsiblePlaybookConnectionOptions) GenerateCommandConnectionOptions() ([]string, error)
GenerateCommandConnectionOptions return a list of connection options flags to be used on ansible-playbook execution
type AnsiblePlaybookOptions ¶
type AnsiblePlaybookOptions struct { // ExtraVars is a map of extra variables used on ansible-playbook execution ExtraVars map[string]interface{} // FlushCache clear the fact cache for every host in inventory FlushCache bool // 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 list all available tags ListTags bool // ListTasks ListTasks bool // Tags list all tasks that would be executed Tags string }
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) GenerateCommandOptions ¶
func (o *AnsiblePlaybookOptions) GenerateCommandOptions() ([]string, error)
GenerateCommandOptions return a list of options flags to be used on ansible-playbook execution
type AnsiblePlaybookPrivilegeEscalationOptions ¶
type AnsiblePlaybookPrivilegeEscalationOptions struct { // Become Become bool // BecomeMethod BecomeMethod string // BecomeUser BecomeUser string // AskBecomePass AskBecomePass bool }
AnsiblePlaybookPrivilegeEscalationOptions object has those parameters described on `Privilege Escalation Options` section within ansible-playbook's man page, and which controls how and which user you become as on target hosts.
func (*AnsiblePlaybookPrivilegeEscalationOptions) GenerateCommandPrivilegeEscalationOptions ¶
func (o *AnsiblePlaybookPrivilegeEscalationOptions) GenerateCommandPrivilegeEscalationOptions() ([]string, error)
GenerateCommandPrivilegeEscalationOptions return a list of privilege escalation options flags to be used on ansible-playbook execution
type DefaultExecute ¶
DefaultExecute is a simple definition of an executor
type Executor ¶
Executor is and interface that should be implemented for those item which could run ansible playbooks
type MockExecute ¶
MockExecute defines a simple executor for testing purposal