Releases: apenella/go-ansible
Release list
v2.4.1
v2.4.0
v2.3.0
Release notes
[2.3.0] (2025-10-31)
Changed
- Use the GNU convention arg=value to create arguments. This fixes an issue detected generating SSH extra arguments.
- Update dependencies
- Use Golang 1.24
v2.2.0
Release notes
[2.2.0] (2025-04-06)
Added
- Add the examples
ansibleplaybook-posix-jsonl-stdoutandansibleplaybook-posix-jsonl-stdout-persistenceto demostrate the usage of theAnsiblePosixJsonlStdoutCallbackExecuteexecutor. - Include the
AnsiblePlaybookJSONLEventResultsstruct into thegithub.com/apenella/go-ansible/v2/pkg/execute/result/jsonpackage that represent theansible.posix.jsonlevents. - Include the
JSONLEventStdoutCallbackResultsstruct into thegithub.com/apenella/go-ansible/v2/pkg/execute/result/jsonas aResultsOutputerto handle theansible.posix.jsonlstdout callback method events. - Support the stdout callback plugin
ansible.posix.jsonlby adding a stdout callback executor:AnsiblePosixJsonlStdoutCallbackExecute.
v2.1.1
Release notes
[2.1.1] (2025-03-14)
Changed
- Bump from golang 1.22 to 1.23
Fixed
- Bump golang.org/x/crypto from 0.22.0 to 0.31.0
- Bump golang.org/x/net v0.24.0 to v0.36.0
v2.1.0
Release notes
[v2.1.0]
Added
- New example ansibleplaybook-ssh-become-root-with-password/, showcasing how to execute a playbook that requires to become root user and set the user password through the variable ansible_sudo_pass
Changed
- The internal package
internal/executable/os/exechas been moved topkg/execute/exec, making it public. Along with this change, theExecstruct has been renamed toOsExec.
v2.0.1
Release notes
v2.0.1 (2024-07-10)
Fixed
- Fixed the String method on the AnsiblePlaybookOptions and AnsibleAdhocOptions structs that does not return the verbose flags correctly.
v2.0.0
Release notes
v2.0.0 (2024-04-20)
Version 2.0.0 of go-ansible introduces several disruptive changes. Read the upgrade guide carefully before proceeding with the upgrade.
BREAKING CHANGES
Note
The latest major version of go-ansible, version 2.x, introduced significant and breaking changes. If you are currently using a version prior to 2.x, please refer to the upgrade guide for detailed information on how to migrate to version 2.x.
- The Go module name has been changed from
github.com/apenella/go-ansibletogithub.com/apenella/go-ansible/v2. So, you need to update your import paths to use the new module name. - The relationship between the executor and
AnsiblePlaybookCmd/AnsibleAdhocCmd/AnsibleInvetoryCmdhas undergone important changes.- Inversion of responsibilities: The executor is now responsible for executing external commands, while
AnsiblePlaybookCmd,AnsibleInventoryCmdandAnsibleAdhocCmdhave cut down their responsibilities, primarily focusing on generating the command to be executed. - Method and Attribute Removal: The following methods and attributes have been removed on
AnsiblePlaybookCmd,AnsibleInventoryCmdandAnsibleAdhocCmd:- The
Runmethod. - The
ExecandStdoutCallbackattributes.
- The
- Attributes Renaming: The
Optionsattribute has been renamed toPlaybookOptionsinAnsiblePlaybookCmd,AdhocOptionsinAnsibleAdhocCmdandInventoryOptionsinAnsibleInventoryCmd.
- Inversion of responsibilities: The executor is now responsible for executing external commands, while
- The
Executorinterface has undergone a significant signature change. This change entails the removal of the following argumentsresultsFuncandoptions. The current signature is:Execute(ctx context.Context) error. - The
github.com/apenella/go-ansible/pkg/optionspackage has been removed. After that deletion, the attributes fromAnsibleConnectionOptionsandAnsiblePrivilegeEscalationOptionsattributes have been moved to thePlaybookOptions,AdhocOptionsandInventoryOptionsstructs. - The
github.com/apenella/go-ansible/pkg/stdoutcallbackpackage 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/stdoutcallbackthat enables the setting of the stdout callback. - The constants
AnsibleForceColorEnvandAnsibleHostKeyCheckingEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. - The functions
AnsibleForceColor,AnsibleAvoidHostKeyCheckingandAnsibleSetEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. Use theExecutorWithAnsibleConfigurationSettingsdecorator instead defined in thegithub.com/apenella/go-ansible/v2/pkg/execute/configurationpackage. - The methods
WithWriteandWithShowdurationhave been removed from theExecutorTimeMeasurementdecorator. Instead, a new method namedDurationhas been introduced for obtaining the duration of the execution. - In the
AnsiblePlaybookJSONResultsPlayTaskHostsItemstruct, the attributesStdoutLinesandStderrLineshave chnage their type from[]stringto[]interface{}.
Fixed
- Quote properly the attributes
SCPExtraArgs,SFTPExtraArgs,SSHCommonArgs,SSHExtraArgsinAnsibleAdhocOptionsandAnsiblePlaybookOptionsstructs when generating the command to be executed. #140 - When using the JSON Stdout Callback method combined with enabled verbosity in the command, it causes an error during JSON parsing. To resolve this issue, the
DefaultExecutestruct includes theQuietmethod, which removes verbosity from the executed command. #110
Added
AnsibleAdhocExecuteexecutor has been introduced. That executor allows you to create an executor to runansiblecommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/adhocpackage.AnsibleInventoryExecuteexecutor has been introduced. That executor allows you to create an executor to runansible-inventorycommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/inventorypackage.ansibleplaybook-embed-pythonexample to demonstrate how to usego-ansiblelibrary along with thego-embed-pythonpackage.ansibleplaybook-extravarsexample to show how to configure extra vars when running an Ansible playbook command.ansibleplaybook-sshexample to show how to execute an Ansible playbook using SSH as the connection method.AnsiblePlaybookExecuteexecutor has been introduced. That executor allows you to create an executor to runansible-playbookcommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/playbookpackage.Commanderinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/executepackage. This interface defines the criteria for a struct to be compliant in generating execution commands.ErrorEnricherinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/executepackage. This interface defines the criteria for a struct to be compliant in enriching the error message of the command execution.Executablerinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/executepackage. This interface defines the criteria for a struct to be compliant in executing external commands.ExecutorEnvVarSetterinterface ingithub.com/apenella/go-ansible/v2/pkg/execute/configurationdefines the criteria for a struct to be compliant in setting Ansible configuration.ExecutorQuietStdoutCallbackSetterinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/stdoutcallbackpackage. This interface defines the criteria for a struct to be compliant in setting an executor that accepts the stdout callback configuration and that enables theQuietmethod for Ansible executions.ExecutorStdoutCallbackSetterinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/stdoutcallbackpackage. 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/execpackage has been introduced. This package serves as a wrapper foros.exec.github.com/apenella/go-ansible/v2/pkg/execute/configurationpackage includes theExecutorWithAnsibleConfigurationSettingsstruct, which acts as a decorator that facilitates the configuration of Ansible settings within the executor.github.com/apenella/go-ansible/v2/pkg/execute/result/defaultpackage has been introduced. This package offers the default component for printing execution results. It supersedes theDefaultStdoutCallbackResultsfunction that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallbackpackage.github.com/apenella/go-ansible/v2/pkg/execute/result/jsonpackage has been introduced. This package offers the component for printing execution results from the JSON stdout callback. It supersedes theJSONStdoutCallbackResultsfunction that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallbackpackage.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/workflowpackage 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/installpackage 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-collectionhas 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/installpackage 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-rolehas been added to demonstrate how to install an Ansible role and execute an Ansible playbook in a sequence.golangci-linthas been added to the CI/CD pipeline to ensure the code quality.NewAnsibleAdhocCmd,NewAnsibleInventoryCmdandNewAnsiblePlaybookCmdfunctions have been introduced. These functions are responsible for creating theAnsibleAdhocCmd,AnsibleInventoryCmdandAnsiblePlaybookCmdstructs, respectively.Pathattribute has been added to theAnsiblePlaybookJSONResultsPlayTaskHostsItemstruct.ResultsOutputerinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/resultpackage. This interface defines the criteria for a struct to be compliant in printing execution results.- A utility to generate the code for the configuration package has been introduced. This utility is located in the
utils/cmd/configGenerator.go. - The
Quietmethod has been added to theDefaultExecutestruct. This method forces to remove verbosity from the executed command.
Changed
DefaultExecuteused theStringmethod from theCommanderto include the command in the error message when the execution fails, instead of using the theStringmethod from theos/exec.Cmdstruct.- In the
AnsiblePlaybookJSONResultsPlayTaskHostsItemstruct, the attributesStdoutLinesandStderrLineshave chnage their type from[]stringto[]interface{}. - T...
v2.0.0-rc.3
Release notes
v2.0.0-rc.3
Version 2.0.0 of go-ansible introduces several disruptive changes. Read the upgrade guide carefully before proceeding with the upgrade.
BREAKING CHANGES
Note
The latest major version of go-ansible, version 2.x, introduced significant and breaking changes. If you are currently using a version prior to 2.x, please refer to the upgrade guide for detailed information on how to migrate to version 2.x.
- The Go module name has been changed from
github.com/apenella/go-ansibletogithub.com/apenella/go-ansible/v2. So, you need to update your import paths to use the new module name. - The relationship between the executor and
AnsiblePlaybookCmd/AnsibleAdhocCmd/AnsibleInvetoryCmdhas undergone important changes.- Inversion of responsibilities: The executor is now responsible for executing external commands, while
AnsiblePlaybookCmd,AnsibleInventoryCmdandAnsibleAdhocCmdhave cut down their responsibilities, primarily focusing on generating the command to be executed. - Method and Attribute Removal: The following methods and attributes have been removed on
AnsiblePlaybookCmd,AnsibleInventoryCmdandAnsibleAdhocCmd:- The
Runmethod. - The
ExecandStdoutCallbackattributes.
- The
- Attributes Renaming: The
Optionsattribute has been renamed toPlaybookOptionsinAnsiblePlaybookCmd,AdhocOptionsinAnsibleAdhocCmdandInventoryOptionsinAnsibleInventoryCmd.
- Inversion of responsibilities: The executor is now responsible for executing external commands, while
- The
Executorinterface has undergone a significant signature change. This change entails the removal of the following argumentsresultsFuncandoptions. The current signature is:Execute(ctx context.Context) error. - The
github.com/apenella/go-ansible/pkg/optionspackage has been removed. After that deletion, the attributes fromAnsibleConnectionOptionsandAnsiblePrivilegeEscalationOptionsattributes have been moved to thePlaybookOptions,AdhocOptionsandInventoryOptionsstructs. - The
github.com/apenella/go-ansible/pkg/stdoutcallbackpackage 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/stdoutcallbackthat enables the setting of the stdout callback. - The constants
AnsibleForceColorEnvandAnsibleHostKeyCheckingEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. - The functions
AnsibleForceColor,AnsibleAvoidHostKeyCheckingandAnsibleSetEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. Use theExecutorWithAnsibleConfigurationSettingsdecorator instead defined in thegithub.com/apenella/go-ansible/v2/pkg/execute/configurationpackage. - The methods
WithWriteandWithShowdurationhave been removed from theExecutorTimeMeasurementdecorator. Instead, a new method namedDurationhas been introduced for obtaining the duration of the execution.
Fixed
- Quote properly the attributes
SCPExtraArgs,SFTPExtraArgs,SSHCommonArgs,SSHExtraArgsinAnsibleAdhocOptionsandAnsiblePlaybookOptionsstructs when generating the command to be executed. #140
Added
AnsibleAdhocExecuteexecutor has been introduced. That executor allows you to create an executor to runansiblecommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/adhocpackage.AnsibleInventoryExecuteexecutor has been introduced. That executor allows you to create an executor to runansible-inventorycommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/inventorypackage.ansibleplaybook-extravarsexample to show how to configure extra vars when running an Ansible playbook command.ansibleplaybook-sshexample to show how to execute an Ansible playbook using SSH as the connection method.AnsiblePlaybookExecuteexecutor has been introduced. That executor allows you to create an executor to runansible-playbookcommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/playbookpackage.Commanderinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/executepackage. This interface defines the criteria for a struct to be compliant in generating execution commands.Executablerinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/executepackage. This interface defines the criteria for a struct to be compliant in executing external commands.ExecutorEnvVarSetterinterface ingithub.com/apenella/go-ansible/v2/pkg/execute/configurationdefines the criteria for a struct to be compliant in setting Ansible configuration.ExecutorStdoutCallbackSetterinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/stdoutcallbackpackage. 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/execpackage has been introduced. This package serves as a wrapper foros.exec.github.com/apenella/go-ansible/v2/pkg/execute/configurationpackage includes theExecutorWithAnsibleConfigurationSettingsstruct, which acts as a decorator that facilitates the configuration of Ansible settings within the executor.github.com/apenella/go-ansible/v2/pkg/execute/result/defaultpackage has been introduced. This package offers the default component for printing execution results. It supersedes theDefaultStdoutCallbackResultsfunction that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallbackpackage.github.com/apenella/go-ansible/v2/pkg/execute/result/jsonpackage has been introduced. This package offers the component for printing execution results from the JSON stdout callback. It supersedes theJSONStdoutCallbackResultsfunction that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallbackpackage.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/workflowpackage 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/installpackage 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-collectionhas 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/installpackage 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-rolehas been added to demonstrate how to install an Ansible role and execute an Ansible playbook in a sequence.NewAnsibleAdhocCmd,NewAnsibleInventoryCmdandNewAnsiblePlaybookCmdfunctions have been introduced. These functions are responsible for creating theAnsibleAdhocCmd,AnsibleInventoryCmdandAnsiblePlaybookCmdstructs, respectively.ResultsOutputerinterface has been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/resultpackage. This interface defines the criteria for a struct to be compliant in printing execution results.- A utility to generate the code for the configuration package has been introduced. This utility is located in the
utils/cmd/configGenerator.go.
Changed
- The
AnsibleAdhocCmdstruct has been updated to implement theCommanderinterface. - The
AnsibleInventoryCmdstruct has been updated to implement theCommanderinterface. - The
AnsiblePlaybookCmdstruct has been updated to implement theCommanderinterface. - The
AnsiblePlaybookOptionsandAnsibleAdhocOptionsstructs have been updated to include the attributes fromAnsibleConnectionOptionsandAnsiblePrivilegeEscalationOptions. - The
DefaultExecutestruct has been updated to have a new attribute namedExecof typeExecutablerthat is responsible for executing external commands. - The
DefaultExecutestruct has been updated to have a new attribute namedOutputof typeResultsOutputerthat is responsible for printing the execution's output. - The
DefaultExecutestruct has been updated to implement theExecutorinterface. - The
DefaultExecutestruct has been updated to implement theExecutorEnvVarSetterinterface. - The
DefaultExecutestruct has been updated to implement theExecutorStdoutCallbackSetterinterface. - The
Optionsattribute inAnsibleAdhocCmdstruct has been renamed toAdhocOptions. - The
Optionsattribute inAnsibleInventoryCmdstruct has been renamed toInventoryOptions. - The
Optionsattribute inAnsiblePlaybookCmdstruct has been renamed toPlaybookOptions. - The examples has been adapted to use executor as the component to execute Ansible commands.
- The package
github.com/apenella/go-ansible/pkg/stdoutcallback/result/transformerhas been moved togithub.com/apenella/go-ansible/v2/pkg/execute/result/transformer.
Removed
- The
Execattribute has been removed fromAnsiblePlaybookCmdandAdhocPlaybookCmd. - The
github.com/apenella/go-ansible/pkg/optionspackage has been removed. After theAnsibleConnectionOptionsand `...
v2.0.0-rc.2
Release notes
v2.0.0-rc.2
Version 2.0.0 of go-ansible introduces several disruptive changes. Read the upgrade guide carefully before proceeding with the upgrade.
BREAKING CHANGES
Note
The latest major version of go-ansible, version 2.x, introduced significant and breaking changes. If you are currently using a version prior to 2.x, please refer to the upgrade guide for detailed information on how to migrate to version 2.x.
- The Go module name has been changed from
github.com/apenella/go-ansibletogithub.com/apenella/go-ansible/v2. So, you need to update your import paths to use the new module name. - The relationship between the executor and
AnsiblePlaybookCmd/AnsibleAdhocCmd/AnsibleInvetoryCmdhas undergone important changes.- Inversion of responsabilities: The executor is now responsible for executing external commands, while
AnsiblePlaybookCmd,AnsibleInventoryCmdandAnsibleAdhocCmdhave cut down their responsibilities, primarily focusing on generating the command to be executed. - Method and Attribute Removal: The following methods and attributes have been removed on
AnsiblePlaybookCmd,AnsibleInventoryCmdandAnsibleAdhocCmd:- The
Runmethod. - The
ExecandStdoutCallbackattributes.
- The
- Attributes Renaming: The
Optionsattribute has been renamed toPlaybookOptionsinAnsiblePlaybookCmd,AdhocOptionsinAnsibleAdhocCmdandInventoryOptionsinAnsibleInventoryCmd.
- Inversion of responsabilities: The executor is now responsible for executing external commands, while
- The
Executorinterface has undergone a significant signature change. This change entails the removal of the following argumentsresultsFuncandoptions. The current signature is:Execute(ctx context.Context) error. - The
github.com/apenella/go-ansible/pkg/optionspackage has been removed. After that deletion, the attributes fromAnsibleConnectionOptionsandAnsiblePrivilegeEscalationOptionsattributes have been moved to thePlaybookOptions,AdhocOptionsandInventoryOptionsstructs. - The
github.com/apenella/go-ansible/pkg/stdoutcallbackpackage 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/stdoutcallbackthat enables the setting of the stdout callback. - The constants
AnsibleForceColorEnvandAnsibleHostKeyCheckingEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. - The functions
AnsibleForceColor,AnsibleAvoidHostKeyCheckingandAnsibleSetEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. Use theExecutorWithAnsibleConfigurationSettingsdecorator instead defined in thegithub.com/apenella/go-ansible/v2/pkg/execute/configurationpackage. - The methods
WithWriteandWithShowdurationhave been removed from theExecutorTimeMeasurementdecorator. Instead, a new method namedDurationhas been introduced for obtaining the duration of the execution.
Added
- A new executor
AnsibleAdhocExecutehas been introduced. That executor allows you to create an executor to runansiblecommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/adhocpackage. - A new executor
AnsibleInventoryExecutehas been introduced. That executor allows you to create an executor to runansible-inventorycommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/inventorypackage. - A new executor
AnsiblePlaybookExecutehas been introduced. That executor allows you to create an executor to runansible-playbookcommands using the default settings ofDefaultExecute. This executor is located in thegithub.com/apenella/go-ansible/v2/pkg/execute/playbookpackage. - A new interface
Commanderhas been introduced in thegithub.com/apenella/go-ansible/v2/pkg/executepackage. This interface defines the criteria for a struct to be compliant in generating execution commands. - A new interface
Executablerhas been introduced in thegithub.com/apenella/go-ansible/v2/pkg/executepackage. This interface defines the criteria for a struct to be compliant in executing external commands. - A new interface
ExecutorEnvVarSetteringithub.com/apenella/go-ansible/v2/pkg/execute/configurationthat defines the criteria for a struct to be compliant in setting Ansible configuration. - A new interface
ExecutorStdoutCallbackSetterhas been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/stdoutcallbackpackage. This interface defines the criteria for a struct to be compliant in setting an executor that accepts the stdout callback configuration for Ansible executions. - A new interface named
ResultsOutputerhas been introduced in thegithub.com/apenella/go-ansible/v2/pkg/execute/resultpacakge. This interface defines the criteria for a struct to be compliant in printing execution results. - A new package
github.com/apenella/go-ansible/v2/internal/executable/os/exechas been introduced. This package serves as a wrapper foros.exec. - A new package
github.com/apenella/go-ansible/v2/pkg/execute/configurationthat incldues theExecutorWithAnsibleConfigurationSettingsstruct, which acts as a decorator that facilitates the configuration of Ansible settings within the executor. - A new package
github.com/apenella/go-ansible/v2/pkg/execute/result/defaulthas been introduced. This package offers the default component for printing execution results. It supersedes theDefaultStdoutCallbackResultsfunction that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallbackpackage. - A new package
github.com/apenella/go-ansible/v2/pkg/execute/result/jsonhas been introduced. This package offers the component for printing execution results from the JSON stdout callback. It supersedes theJSONStdoutCallbackResultsfunction that was previously defined in thegithub.com/apenella/go-ansible/v2/pkg/stdoutcallbackpackage. - A new package
github.com/apenella/go-ansible/v2/pkg/execute/stdoutcallback. This package offers multiple decorators designed to set the stdout callback for Ansible executions. - A new package
github.com/apenella/go-ansible/v2/pkg/execute/workflowhas been introduced. This package allows you to define a workflow for executing multiple commands in a sequence. - An utility to generate the code for the configuration package has been introduced. This utility is located in the
utils/cmd/configGenerator.go.
Changed
- The
AnsibleAdhocCmdstruct has been updated to implement theCommanderinterface. - The
AnsibleInventoryCmdstruct has been updated to implement theCommanderinterface. - The
AnsiblePlaybookCmdstruct has been updated to implement theCommanderinterface. - The
AnsiblePlaybookOptionsandAnsibleAdhocOptionsstructs have been updated to include the attributes fromAnsibleConnectionOptionsandAnsiblePrivilegeEscalationOptions. - The
DefaultExecutestruct has been updated to have a new attribute namedExecof typeExecutablerthat is responsible for executing external commands. - The
DefaultExecutestruct has been updated to have a new attribute namedOutputof typeResultsOutputerthat is responsible for printing the execution's output. - The
DefaultExecutestruct has been updated to implement theExecutorinterface. - The
DefaultExecutestruct has been updated to implement theExecutorEnvVarSetterinterface. - The
DefaultExecutestruct has been updated to implement theExecutorStdoutCallbackSetterinterface. - The
Optionsattribute inAnsibleAdhocCmdstruct has been renamed toAdhocOptions. - The
Optionsattribute inAnsibleInventoryCmdstruct has been renamed toInventoryOptions. - The
Optionsattribute inAnsiblePlaybookCmdstruct has been renamed toPlaybookOptions. - The examples has been adapted to use executor as the component to execute Ansible commands.
- The package
github.com/apenella/go-ansible/pkg/stdoutcallback/result/transformerhas been moved togithub.com/apenella/go-ansible/v2/pkg/execute/result/transformer.
Removed
- The
Execattribute has been removed fromAnsiblePlaybookCmdandAdhocPlaybookCmd. - The
github.com/apenella/go-ansible/pkg/optionspackage has been removed. After theAnsibleConnectionOptionsandAnsiblePrivilegeEscalationOptionsstructs are not available anymore. - The
github.com/apenella/go-ansible/pkg/stdoutcallbackpackage has been removed. - The
Runmethod has been removed from theAnsiblePlaybookCmdandAdhocPlaybookCmdstructs. - The
ShowDurationattribute in theDefaultExecutestruct has been removed. - The
StdoutCallbackattribute has been removed fromAnsiblePlaybookCmdandAdhocPlaybookCmd. - The constants
AnsibleForceColorEnvandAnsibleHostKeyCheckingEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. - The functions
AnsibleForceColor,AnsibleAvoidHostKeyCheckingandAnsibleSetEnvhave been removed from thegithub.com/apenella/go-ansible/pkg/optionspackage. Use theExecutorWithAnsibleConfigurationSettingsdecorator instead defined in thegithub.com/apenella/go-ansible/v2/pkg/execute/configurationpackage. - The methods
WithWriteandwithshowdurationhave been removed from theExecutorTimeMeasurementdecorator.