Package org.jenkinsci.plugins.ansible
Class AnsibleAdHocCommandInvocation
- java.lang.Object
-
- org.jenkinsci.plugins.ansible.AnsibleAdHocCommandInvocation
-
public class AnsibleAdHocCommandInvocation extends Object
Invoke the ansible command
-
-
Field Summary
Fields Modifier and Type Field Description protected String
additionalParameters
protected boolean
become
protected String
becomeUser
protected Run<?,?>
build
protected com.cloudbees.plugins.credentials.common.StandardUsernameCredentials
credentials
protected Map<String,String>
environment
protected EnvVars
envVars
protected String
exe
protected List<ExtraVar>
extraVars
protected int
forks
protected TaskListener
listener
protected boolean
sudo
protected String
sudoUser
protected com.cloudbees.plugins.credentials.common.StandardCredentials
vaultCredentials
protected FilePath
vaultTmpPath
-
Constructor Summary
Constructors Modifier Constructor Description protected
AnsibleAdHocCommandInvocation(String exe, AbstractBuild<?,?> build, BuildListener listener)
AnsibleAdHocCommandInvocation(String exe, Run<?,?> build, FilePath ws, TaskListener listener, EnvVars envVars)
-
Method Summary
-
-
-
Field Detail
-
envVars
protected final EnvVars envVars
-
listener
protected final TaskListener listener
-
build
protected final Run<?,?> build
-
exe
protected String exe
-
forks
protected int forks
-
become
protected boolean become
-
becomeUser
protected String becomeUser
-
sudo
protected boolean sudo
-
sudoUser
protected String sudoUser
-
vaultCredentials
protected com.cloudbees.plugins.credentials.common.StandardCredentials vaultCredentials
-
vaultTmpPath
protected FilePath vaultTmpPath
-
credentials
protected com.cloudbees.plugins.credentials.common.StandardUsernameCredentials credentials
-
additionalParameters
protected String additionalParameters
-
-
Constructor Detail
-
AnsibleAdHocCommandInvocation
protected AnsibleAdHocCommandInvocation(String exe, AbstractBuild<?,?> build, BuildListener listener) throws IOException, InterruptedException, AnsibleInvocationException
-
AnsibleAdHocCommandInvocation
public AnsibleAdHocCommandInvocation(String exe, Run<?,?> build, FilePath ws, TaskListener listener, EnvVars envVars) throws IOException, InterruptedException, AnsibleInvocationException
-
-
Method Detail
-
setHostPattern
public AnsibleAdHocCommandInvocation setHostPattern(String hostPattern)
-
setModule
public AnsibleAdHocCommandInvocation setModule(String module)
-
setModuleCommand
public AnsibleAdHocCommandInvocation setModuleCommand(String command)
-
appendModuleCommand
public ArgumentListBuilder appendModuleCommand(ArgumentListBuilder args)
-
buildCommandLine
protected ArgumentListBuilder buildCommandLine() throws InterruptedException, AnsibleInvocationException, IOException
-
appendExecutable
protected ArgumentListBuilder appendExecutable(ArgumentListBuilder args)
-
setInventory
public T setInventory(Inventory inventory)
-
appendInventory
protected ArgumentListBuilder appendInventory(ArgumentListBuilder args) throws IOException, InterruptedException, AnsibleInvocationException
-
setForks
public T setForks(int forks)
-
appendForks
public ArgumentListBuilder appendForks(ArgumentListBuilder args)
-
appendExtraVars
public ArgumentListBuilder appendExtraVars(ArgumentListBuilder args)
-
setAdditionalParameters
public T setAdditionalParameters(String additionalParameters)
-
appendAdditionalParameters
public ArgumentListBuilder appendAdditionalParameters(ArgumentListBuilder args)
-
setBecome
public T setBecome(boolean become, String becomeUser)
-
appendBecome
protected ArgumentListBuilder appendBecome(ArgumentListBuilder args)
-
setSudo
public T setSudo(boolean sudo, String sudoUser)
-
appendSudo
protected ArgumentListBuilder appendSudo(ArgumentListBuilder args)
-
addOptionAndValue
protected void addOptionAndValue(ArgumentListBuilder args, String option, String value)
-
addKeyValuePair
protected void addKeyValuePair(ArgumentListBuilder args, String key, String value)
-
setCredentials
public T setCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials credentials)
-
setCredentials
public T setCredentials(com.cloudbees.plugins.credentials.common.StandardUsernameCredentials credentials, boolean copyCredentialsInWorkspace)
-
setVaultCredentials
public T setVaultCredentials(com.cloudbees.plugins.credentials.common.StandardCredentials vaultCredentials)
-
setVaultTmpPath
public T setVaultTmpPath(FilePath vaultTmpPath)
-
prependPasswordCredentials
protected ArgumentListBuilder prependPasswordCredentials(ArgumentListBuilder args)
-
appendCredentials
protected ArgumentListBuilder appendCredentials(ArgumentListBuilder args) throws IOException, InterruptedException
- Throws:
IOException
InterruptedException
-
appendVaultPasswordFile
protected ArgumentListBuilder appendVaultPasswordFile(ArgumentListBuilder args) throws IOException, InterruptedException
- Throws:
IOException
InterruptedException
-
setUnbufferedOutput
public T setUnbufferedOutput(boolean unbufferedOutput)
-
setColorizedOutput
public T setColorizedOutput(boolean colorizedOutput)
-
setDisableHostKeyCheck
public T setDisableHostKeyCheck(boolean disableHostKeyChecking)
-
execute
public boolean execute(CLIRunner runner) throws IOException, InterruptedException, AnsibleInvocationException
-
-