-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added basic support for ssh on Windows for raw script execution through Ansible #752
Conversation
…ental-windows-target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 👏
@@ -876,6 +885,10 @@ func (e *executionCommon) generateHostConnection(ctx context.Context, buffer *by | |||
if host.port != 0 && host.port != 22 { | |||
buffer.WriteString(fmt.Sprintf(" ansible_ssh_port=%d", host.port)) | |||
} | |||
// Specific ansible connection settings are needed on windows targets | |||
if strings.Contains(host.osType, "windows") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know but maybe it worthwhile to be mentioned somehow in the documentation.
Maybe here https://yorc.readthedocs.io/en/stable/tosca.html#supported-operations-implementations
As it seems to be a very specific behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, proposign to add this:
Basic support for raws scripts execution through Ansible playbooks is also provided on Windows targets configured to use ssh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
SonarCloud Quality Gate failed. |
Pull Request description
Description of the change
Added the ability to run scripts on Windows through Ansible, having openssh configured on the Windows host as described at https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
What I did
The following modifications were done:
prov/ansible/execution.go
As described in https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html#configuring-ansible-for-ssh-on-windows
to configure Ansible to use SSH for Windows hosts, defining
ansible_connection=ssh
andansible_shell_type=cmd
prov/ansible/execution_ansible.go
:The creation/removal of files and drectories is done using
ansible.windows.win_file
on Windowsprov/terraform/commons/resources.go
:Updated the default timeout as windows provisionning can take more time than linux distributions
helper/consulutil/consul_ratelimit_publisher.go
misc.: added a logs in daemon in case of failure storing a value
How to verify it
Tested in LEXIS context, in a component running this playbook: https://github.com/lexis-project/application-templates/blob/v0.1.3/weather-climate/components/adms/playbooks/adms_run.yaml
first creating a powershell script from a template
then executing this script
Description for the changelog
Add basic support for ssh on Windows (GH-751)
Applicable Issues
Closes #751