Update module github.com/apenella/go-ansible to v2 #343
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v1.3.0
->v2.0.1
Release Notes
apenella/go-ansible (github.com/apenella/go-ansible)
v2.0.1
Compare Source
Fixed
v2.0.0
Compare Source
Version 2.0.0 of go-ansible introduces several disruptive changes. Read the upgrade guide carefully before proceeding with the upgrade.
BREAKING CHANGES
github.com/apenella/go-ansible
togithub.com/apenella/go-ansible/v2
. So, you need to update your import paths to use the new module name.AnsiblePlaybookCmd
/AnsibleAdhocCmd
/AnsibleInvetoryCmd
has undergone important changes.AnsiblePlaybookCmd
,AnsibleInventoryCmd
andAnsibleAdhocCmd
have cut down their responsibilities, primarily focusing on generating the command to be executed.AnsiblePlaybookCmd
,AnsibleInventoryCmd
andAnsibleAdhocCmd
:Run
method.Exec
andStdoutCallback
attributes.Options
attribute has been renamed toPlaybookOptions
inAnsiblePlaybookCmd
,AdhocOptions
inAnsibleAdhocCmd
andInventoryOptions
inAnsibleInventoryCmd
.Executor
interface has undergone a significant signature change. This change entails the removal of the following argumentsresultsFunc
andoptions
. The current signature is:Execute(ctx context.Context) error
.github.com/apenella/go-ansible/pkg/options
package has been removed. After that deletion, the attributes fromAnsibleConnectionOptions
andAnsiblePrivilegeEscalationOptions
attributes have been moved to thePlaybookOptions
,AdhocOptions
andInventoryOptions
structs.github.com/apenella/go-ansible/pkg/stdoutcallback
package has been removed. Its responsibilities have been absorbed by two distinc packagesgithub.com/apenella/go-ansible/v2/pkg/execute/result
, which manages the output of the commands, andgithub.com/apenella/go-ansible/v2/pkg/execute/stdoutcallback
that enables the setting of the stdout callback.AnsibleForceColorEnv
andAnsibleHostKeyCheckingEnv
have been removed from thegithub.com/apenella/go-ansible/pkg/options
package.AnsibleForceColor
,AnsibleAvoidHostKeyChecking
andAnsibleSetEnv
have been removed from thegithub.com/apenella/go-ansible/pkg/options
package. Use theExecutorWithAnsibleConfigurationSettings
decorator instead defined in thegithub.com/apenella/go-ansible/v2/pkg/execute/configuration
package.WithWrite
andWithShowduration
have been removed from theExecutorTimeMeasurement
decorator. Instead, a new method namedDuration
has been introduced for obtaining the duration of the execution.AnsiblePlaybookJSONResultsPlayTaskHostsItem
struct, the attributesStdoutLines
andStderrLines
have chnage their type from[]string
to[]interface{}
.Fixed
SCPExtraArgs
,SFTPExtraArgs
,SSHCommonArgs
,SSHExtraArgs
inAnsibleAdhocOptions
andAnsiblePlaybookOptions
structs when generating the command to be executed. #140DefaultExecute
struct includes theQuiet
method, which removes verbosity from the executed command. #110Added
AnsibleAdhocExecute
executor has been introduced. That executor allows you to create an executor to runansible
commands using the default settings ofDefaultExecute
. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/adhoc
package.AnsibleInventoryExecute
executor has been introduced. That executor allows you to create an executor to runansible-inventory
commands using the default settings ofDefaultExecute
. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/inventory
package.ansibleplaybook-embed-python
example to demonstrate how to usego-ansible
library along with thego-embed-python
package.ansibleplaybook-extravars
example to show how to configure extra vars when running an Ansible playbook command.ansibleplaybook-ssh
example to show how to execute an Ansible playbook using SSH as the connection method.AnsiblePlaybookExecute
executor has been introduced. That executor allows you to create an executor to runansible-playbook
commands using the default settings ofDefaultExecute
. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/playbook
package.Commander
interface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute
package. This interface defines the criteria for a struct to be compliant in generating execution commands.ErrorEnricher
interface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute
package. This interface defines the criteria for a struct to be compliant in enriching the error message of the command execution.Executabler
interface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute
package. This interface defines the criteria for a struct to be compliant in executing external commands.ExecutorEnvVarSetter
interface ingithub.com/apenella/go-ansible/v2/pkg/execute/configuration
defines the criteria for a struct to be compliant in setting Ansible configuration.ExecutorQuietStdoutCallbackSetter
interface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/stdoutcallback
package. This interface defines the criteria for a struct to be compliant in setting an executor that accepts the stdout callback configuration and that enables theQuiet
method for Ansible executions.ExecutorStdoutCallbackSetter
interface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/stdoutcallback
package. This interface defines the criteria for a struct to be compliant in setting an executor that accepts the stdout callback configuration for Ansible executions.github.com/apenella/go-ansible/v2/internal/executable/os/exec
package has been introduced. This package serves as a wrapper foros.exec
.github.com/apenella/go-ansible/v2/pkg/execute/configuration
package includes theExecutorWithAnsibleConfigurationSettings
struct, which acts as a decorator that facilitates the configuration of Ansible settings within the executor.github.com/apenella/go-ansible/v2/pkg/execute/result/default
package has been introduced. This package offers the default component for printing execution results. It supersedes theDefaultStdoutCallbackResults
function that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallback
package.github.com/apenella/go-ansible/v2/pkg/execute/result/json
package has been introduced. This package offers the component for printing execution results from the JSON stdout callback. It supersedes theJSONStdoutCallbackResults
function that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallback
package.github.com/apenella/go-ansible/v2/pkg/execute/stdoutcallback
. package has been introduced and offers multiple decorators designed to set the stdout callback for Ansible executions.github.com/apenella/go-ansible/v2/pkg/execute/workflow
package has been introduced and allows you to define a workflow for executing multiple commands in a sequence.github.com/apenella/go-ansible/v2/pkg/galaxy/collection/install
package has been introduced. This package allows you to install Ansible collections from the Ansible Galaxy. Along with this package, the exampleworkflowexecute-ansibleplaybook-with-galaxy-install-collection
has been added to demonstrate how to install an Ansible collection and execute an Ansible playbook in a sequence.github.com/apenella/go-ansible/v2/pkg/galaxy/role/install
package has been introduced. This package allows you to install Ansible roles from the Ansible Galaxy. Along with this package, the exampleworkflowexecute-ansibleplaybook-with-galaxy-install-role
has been added to demonstrate how to install an Ansible role and execute an Ansible playbook in a sequence.golangci-lint
has been added to the CI/CD pipeline to ensure the code quality.NewAnsibleAdhocCmd
,NewAnsibleInventoryCmd
andNewAnsiblePlaybookCmd
functions have been introduced. These functions are responsible for creating theAnsibleAdhocCmd
,AnsibleInventoryCmd
andAnsiblePlaybookCmd
structs, respectively.Path
attribute has been added to theAnsiblePlaybookJSONResultsPlayTaskHostsItem
struct.ResultsOutputer
interface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/result
package. This interface defines the criteria for a struct to be compliant in printing execution results.utils/cmd/configGenerator.go
.Quiet
method has been added to theDefaultExecute
struct. This method forces to remove verbosity from the executed command.Changed
DefaultExecute
used theString
method from theCommander
to include the command in the error message when the execution fails, instead of using the theString
method from theos/exec.Cmd
struct.AnsiblePlaybookJSONResultsPlayTaskHostsItem
struct, the attributesStdoutLines
andStderrLines
have chnage their type from[]string
to[]interface{}
.AnsibleAdhocCmd
struct has been updated to implement theCommander
interface.AnsibleInventoryCmd
struct has been updated to implement theCommander
interface.AnsiblePlaybookCmd
struct has been updated to implement theCommander
interface.AnsiblePlaybookOptions
andAnsibleAdhocOptions
structs have been updated to include the attributes fromAnsibleConnectionOptions
andAnsiblePrivilegeEscalationOptions
.DefaultExecute
struct has been updated to have a new attribute namedExec
of typeExecutabler
that is responsible for executing external commands.DefaultExecute
struct has been updated to have a new attribute namedOutput
of typeResultsOutputer
that is responsible for printing the execution's output.DefaultExecute
struct has been updated to implement theExecutor
interface.DefaultExecute
struct has been updated to implement theExecutorEnvVarSetter
interface.DefaultExecute
struct has been updated to implement theExecutorStdoutCallbackSetter
interface.Execute
method in theDefaultExecute
struct has been updated to return an error on the deferred function when the command execution fails.Options
attribute inAnsibleAdhocCmd
struct has been renamed toAdhocOptions
.Options
attribute inAnsibleInventoryCmd
struct has been renamed toInventoryOptions
.Options
attribute inAnsiblePlaybookCmd
struct has been renamed toPlaybookOptions
.Read
method in theReadPasswordFromEnvVar
struct from thegithub.com/apenella/go-ansible/v2/vault/password/envvars
package has been updated to log a warning message when the environment variable is not set.github.com/apenella/go-ansible/pkg/stdoutcallback/result/transformer
has been moved togithub.com/apenella/go-ansible/v2/pkg/execute/result/transformer
.1.19
to1.22
.Removed
DefaultExecute
ansible-playbook error enrichment.Exec
attribute has been removed fromAnsiblePlaybookCmd
andAdhocPlaybookCmd
.github.com/apenella/go-ansible/pkg/options
package has been removed. After theAnsibleConnectionOptions
andAnsiblePrivilegeEscalationOptions
structs are not available anymore.github.com/apenella/go-ansible/pkg/stdoutcallback
package has been removed.Run
method has been removed from theAnsiblePlaybookCmd
andAdhocPlaybookCmd
structs.ShowDuration
attribute in theDefaultExecute
struct has been removed.StdoutCallback
attribute has been removed fromAnsiblePlaybookCmd
andAdhocPlaybookCmd
.AnsibleForceColorEnv
andAnsibleHostKeyCheckingEnv
have been removed from thegithub.com/apenella/go-ansible/pkg/options
package.AnsibleForceColor
,AnsibleAvoidHostKeyChecking
andAnsibleSetEnv
have been removed from thegithub.com/apenella/go-ansible/pkg/options
package. Use theExecutorWithAnsibleConfigurationSettings
decorator instead defined in thegithub.com/apenella/go-ansible/v2/pkg/execute/configuration
package.WithWrite
andwithshowduration
have been removed from theExecutorTimeMeasurement
decorator.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.