Azure Cloud Shell Ansible with Windows hosts - azure

Since the announcement I'm able to list my Azure infrastructure in the Azure Cloud Shell with ansible.
I want to use it with Windows machines too. I installed the winrm locally as it seems that globally is not supported.
pip install "pywinrm>=0.2.2" --user
With this I understand packages are correctly installed
pywinrm (0.3.0)
requests (2.18.4)
xmltodict (0.11.0)
...
Then I run, with the proper credentials a win ping but ansible complains that the WinRM is not available.
ansible -i workspace/azure_rm.py -m win_ping DC-01
Is it possible to run ansible in cloud shell with windows hosts?

Make sure your windows hosts are setup for WinRM control. That means you should check off a few things are working, you can see what Ansible has to say about it here.
Network path is open on TCP port 5985-5986 (try to telnet)
Powershell 3.0 or above is installed
WinRM remoting has been configured for the remote windows host.
Make sure the ansible play is using WinRM port to connect
You can use the excellent PS script ansible provides with a little modification if needed to setup your local certs and configure the box from here.

I finally opened a post on MSDN forums and Microsoft identified the missing dependency and added in the Cloud Shell!
Finally it is possible to use Ansible from the Cloud Shell. The only consideration is that the target VM should have internet connectivity on port 5986.
Also there is a sample script to test it.

Related

Azure windows server 2019 install docker

I hope somebody can help me with this issue.
I have a windows server 2019 hosted on azure. I would like to install docker for some tests.
Before to jump to docker, I updated the operative system
I downloaded docker desktop from docker website.
Installation went without any issue.
But when I try to start the app, I get the error that the Hyper-V is not running.
At this point, in the server management tool => add features I checked if Hyper-v was installed and if containers was also installed, After this I went to services.msc and restarted Hyper-v managment and also set to auto hypervisorlaunchtype and restarted the VM. When I logged in back, I had the same issue.
I know this is a case of nested virtualisation, but I was wondering if is achievable on a cloud platform.
Can please anyone help me to understand this and if its possible or/and what I am doing wrong
I tried to install the docker desktop in my environment and it was successful with out any issue. Created a vm with windows server 2019 and updated to latest and installed docker desktop from here Install Docker Desktop on Windows and it is running as expected.
Nested virtualizations is supported in azure but all the vm sizes not support nested virtualization, So Try to deploy the VM with any of the following series D_v3; Ds_v3; E_v3; Es_v3; F2s_v2 – F72s_v2; M and check.

How ansible copy file from remote windows to remote linux without local copy and ssh install in windows

OS: Wk16 vs Debian 10.4
Ansible: 2.9
Hi all
I need to send a file from remote Windows to remote linux without to copy in local without to install ssh package in Windows server.
A Win_server <-- Ansible role executor -- B Ansible_host C linux_host
|
| ^
|___SENDING FILE_______________________________________TO___________|
Thank's a lot
Checkout syncronize module at Ansible Documentation: https://docs.ansible.com/ansible/latest/collections/ansible/posix/synchronize_module.html
Also, be aware to stablish direct ssh connection between targets.
Hint: It's possible to activate ssh on windows and stablish connection to the linux machine. Take care of the risks!
Other way is to use fetch and copy to do the triangle copy using Ansible server as elbow.
Today I putted the SSH in Windows how #guistela sayed.
I Installed "Posh-SSH" on Windows host with ansible:
Manual Download from:
https://www.powershellgallery.com/packages/Posh-SSH.
Send file to Windows host contains files to send.
Install with microsoft steps: Installing PowerShell modules from a
NuGet package.
Possh-SSH use commands, more info here:
powershell-scp-to-transfer-files-between-windows-linux:
Open ports
Send file
Close ports
This 4 general steps permits send files from windows to linux hosts.
Cordially

OpenSSH server wont install on azure Windows 10 VM

I'm trying to install OpenSSH-Server on multiple Windows 10 VM from Azure.
I added some rules on network security group (directly on portal.azure) : I allowed inbound traffic for port 22 and same for outbound.
After that I tried to install openSSH-server using the windows 10 interface, but it doesn't work (no error message, just jumping back into the app list).
I tried to add the rules to the firewall and retried to install openSSH-server, no success.
I also tried to install it using powershell but without success.
There is something I must be missing, here is the guide I followed for installing OpenSSH-server: https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
And here is the guide I followed for opening ports:
https://learn.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal
Ok so I finally find out what was blocking the installation, the Windows update service was deactivated, by activating it I was able to install OpenSSH-Server, all good now !

Run artifactory on browser

I installed artifactory on linux server. I want to know how to check whether it is properly installed.
Secondly, I want to use it's user interface on google chrome. From where I can get SERVER_DOMAIN and PORT number for it's url from installed files on server?
Thanks in advance.
Your question is a bit vague.
How did you installed it (ZIP, RPM, Docker, Deb...)?
Which database you used (default, Oracle, MySQL etc..)? You can see if the server is up and running by running the following REST API from the machine you have installed it on:
curl -iuadmin:password localhost:8081/artifactory/api/system/ping
Regarding the IP, this can be checked by running 'ifconfig' on the linux server and get the IP of that machine.
Artifactory by default is running on port 8081, unless you changed it.
It seems that you will need to follow the basic installation wiki:
https://www.jfrog.com/confluence/display/RTF/Installing+Artifactory

How do I install XAMPP in a remote server?

I recently opened up a webserver in Amazon EC2. I managed to log in to the server using SSH with my mac. I also managed to install the EC2 API tool provided from Amazon. I have the XAMPP installation on my desktop. And I opened up a linux instance. I don't think I have a EBS(Elastic Block Store) mounted to the instance yet, I don't know how to do that. But How do copy the XAMPP installation file from my desktop to the server instance? Pls give me step-by-step instructions
I manage to solve my own question. I was using the scp protocol to transfer the XAMPP installation file. More info on this link: Secure Remote Logins and File Copying. This is the first time I used it, but you just type the command: scp -i ***.pem ec2-user#some_public_DNS /The/file/on/your/desktop. The file will then be transfer in a secure way to the remote server
I'm curious as to why you'd try to put XAMPP on an EC2 instance instead of simply using your system's package management system (e.g., yum, apt-get) to install what you need. This just seems like trying to hammer nails with the back of a screwdriver.

Resources