Ansible: "msg": "basic: Bad HTTP response returned from server. Code 503" - linux

I have ansible version 2.4.2. Trying to integrate Ansible control machine (RHEL) with Windows.
When I run the ping command :
ansible wmdev (hostname) -i hosts -m win_ping
Getting below error while connecting to windows machine:
wmdev | UNREACHABLE! => {
"changed": false,
"msg": "basic: Bad HTTP response returned from server. Code 503",
"unreachable": true
}
I am not sure what his error code means. I tried using Kerberos, Basic, ntlm. But no success. Please help.

I had this same error.
The problem turned out to be proxy.
just run export http_proxy="".

This can also occur if you have http_poxy or HTTP_PROXY set as an environment variable in your linux session.

Try to debug this issue using following methods.
--> manually ping the destination server ip address. if you are not able to reach then it should be network issue.
--> Verify you host file. It should have following vars to connect to windows machine:
ansible_user=<user>
ansible_password=<password>
ansible_connection=winrm
ansible_winrm_transport=basic
ansible_ssh_port=5985
--> winrm should be enabled on your windows machine.
--> target windows machine execution policy should not be unrestricted.
--> verify net firewall rule "Windows Remote Management (HTTP-In)", if not available set it.

Related

jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection Message [Auth fail]

I am learning to use Jenkins to deploy a .Net 5.0 application on an AWS EC2 server. This is the first time I am using Linux server and Jenkins for .Net (I'm am a life long Windows guy), and I am facing an error while trying to publish my artifacts over SSH to Web Server.
My setup:
Jenkins server is an AWS EC2 Linux AMI server.
Web Server is also an AWS EC2 LInux AMI server.
My Jenkins is correctly installed and working. I am able to build and run unit test cases without any issues.
For Deploy, I am using 'Publish Over SSH' plugin, and I have followed all steps to configure this plugin as mentioned here https://plugins.jenkins.io/publish-over-ssh/.
However, when try to 'Test Configuration', I get the below error,
Failed to connect or change directory
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [WebServer]. Message [Auth fail]]
I did a ping test from Jenkins server to Web Server, and it is a success.
I'm using the .pem key in the 'Key' section of 'Publish over SSH'. This key is the same key I use to SSH into the web server.
The below link suggests many different solutions, but none is working in my case.
Jenkins Publish over ssh authentification failed with private key
I was looking at the below link which describes the same problem,
Jenkins publish over SSH failed to change to remote directory
However in my case I have kept 'Remote Directory' as empty. I don't know if I have to specify any directory here. Anyways, I tried creating a new directory under the home directory of user ec2-user as '/home/ec2-user/publish' and then used this path as Remote Directory, but it still didn't work.
Screenshot of my settings in Jenkins:
I would appreciate if anyone can point me to the right direction or highlight any mistake I'm doing with my configuration.
In my case following steps solved the problem.
Solution is based on Ubuntu 22.04
add two line in /etc/ssh/sshd_config
PubkeyAuthentication yes
PubkeyAcceptedKeyTypes +ssh-rsa
restart sshd service
sudo service sshd restart
you might consider the following:
a. From the screenshot you’ve provided, it seems that you have checked the Use password authentication, or use different key option which will require you to add your key and password (inputs from these fields will be used in connecting to your server via SSH connection). If you use the same SSH key and passphrase/password on all of your servers, you can uncheck/untick that box and just use the config you have specified above.
b. You might also check if port 22 of your web server allows inbound traffic from the security group where your Jenkins server/EC2 instance is running. See reference here.
c. Also, make sure that the remote directory you have specified is existing otherwise the connection may fail.
Here's the sample config

Arangodb not connecting using localhost but accessible using external IP

I installed arangodb on single node ubuntu server, followed this
below is my arangod.conf file:
endpoint = tcp://127.0.0.1:8529
endpoint = tcp://<internalserverIP>:8529
I did enable both of them.
Now i am able to access arango using below on my local system
curl --dump - http://<externalserverIP>:8529/_api/version
so far so good.
now when i try to access same on installed ubuntu server using:
curl --dump - http://127.0.0.1:8529/_api/version
i am getting below error:
Access to the page:
... has been denied for the following reason:
Blocked by Content Checking.
Categories:
Proxies
what am i missing here.
It worked by resetting the proxy to its default by using the below command.
export http_proxy=

Jenkins Error 128 / Git Error 403: Jenkins can't connect to my Bitbucket repository

OS: Ubuntu 16.04
Hypervisor: VirtualBox
Network configuration: Nat Network with port forwarding to access the vms through the host ip. I can also ping a VM from another VM.
I try to connect my Jenkins app hosted on a VM to my BitBucket server also on a VM. I followed a tutorial on internet but when i enter the address of my git repository i'm getting this:
Failed to connect to repository : Command "usr/bin/git ls-remote -h http://admin#192.168.6.102:8005/scm/tes/repository-test.git HEAD" returned status code 128:
stdout:
stderr: fatal: unable to access 'http://admin#192.168.6.102:8005/scm/tes/repository-test.git/': The requested URL returned error: 403
So, to be sure I tried to exectute the command on the terminal... and on the terminal it seems to work.. I can also push, clone, pull etc..
On this image you can see that it's true
Do you have an explanation?
EDIT:
I try some others things like use or not sudo to see if the permissions problem came from that and it seems that it's not the case.
But I see that there is no result when we use the "HEAD" argument.
Do you think that because "HEAD" give no result, git in jenkins interprets it like no answer and returns the damn** error 403?
EDIT 2:
I found that on the web: http: // jenkins-ci.361315.n4.nabble.com/Jenkins-GIT-ls-remote-error-td4646903.html
The guy has the same problem but in a different way, I will try to allocate more RAM to see if it does the trick.
There could be many possible problems, but you are getting 403 - Access Forbidden, which indicates some problem with permissions. I would suggest first common mistakes:
a) trying https instead http - my scm only uses https,
b) check if admin is correct - scm by default uses scmadmin.
Here I run the exact same command twice.
The first time I used the proxy configuration wich I need to access internet, and the second time I set the mandatory server on "none".
So there is a problem with the damn proxy.
I was thinking that the proxy was not used in NAT connection with VirtualBox...
I found the solution.
I had to reinstall jenkins to have a user named "jenkins" with his own home directory.
I don't know if it is linked or not, but I configured my bitbucket server to use only HTTPS with a self signed certificate (I work in lan)
My troubleshoot was linked with my proxy settings.
I disabled all my proxy settings in Linux so I was able to launch the command that did'nt worked in jenkins with terminal.
I logged with sudo su jenkins the commands also worked.
I found out that in the home directory of the jenkins user there was a "proxy.xml" file. I opened it and saw my old proxy settings.
I deleted all the content with vim, saved and restarted and the error was gone.
there can be git version miss match.....
I would suggest you update git once. maybe it will resolve your issues.

Veeam Backup & Replication 9.5: Impossible to add hyper-v host to backup infrastructure (Network path not found, or invalid credentials supplied)

In the software Backup & Replication 9.5 it was not possible to add the local Hyper-V host (standalone) to the backup infrastructure:
Always gives an error "Network path not found, or invalid credentials supplied."
I tried first these tipps: https://www.veeam.com/kb1230
But this solved not my issue...
With a process monitor I saw the application "Veeam.Backup.Satellite.exe" tries to access the file system *\;RdpDr\;:0\192.168.x.x\ADMIN$* with an error "BAD NETWORK NAME".
I had the same problem - getting this error when trying to add a Hyper-V standalone host. My host was running Server 2016 Hyper-V edition (free hyper-V / console only OS).
Found the error to be inability to access the admin$ share... run this command from the host:
netsh advfirewall firewall set rule group=”File and Printer Sharing” new enable=Yes
Worked immediately for me after that!
After a long time I could now find the solution myself:
In the Local security Policy->Local Policies->Security Options->Network security: Restrict NTLM: Incoming NTLM traffic was the value set to Deny all accounts.
After set the value to Allow all it works now :-)

Unable to Connect to Jenkins Server (Amazon Linux AMI)

When I had installed Jenkins on Amazon Linux AMI following steps mentioned in http://bhargavamin.com/how-to-do/install-jenkins-on-amazon-linux-aws/
After installation I was able to open Jenkins through browser but when I selected option "Install Plugins" it showed error as "Unable to connect to Jenkins Server."
So then how to troubleshoot this issue??
The problem here is pretty simple, if you do curl http://127.0.0.1:8080 on your host machine, you should get a message stating:
Authentication required
<!--
You are authenticated as: anonymous
Groups that you are in:
Permission you need to have (but didn't): hudson.model.Hudson.Administer
-->
This means that jenkins has anonymous priviledges which is not allowing any connection.
To solve this issue, you will have to do two changes:
Add Jenkins user to root group: sudo usermod -a -G root jenkins
Make Jenkins listen to all external IPs by editing file /etc/sysconfig/jenkins and changing the JENKINS_LISTEN_ADDRESS="0.0.0.0"
Once this is done, restart the jenkins server and then try to install plugins for jenkins.
I'm using this trick https://issues.jenkins-ci.org/browse/JENKINS-45388 and it works. What I did is add passwd: as prefix of file /var/lib/jenkins/secrets/initialAdminPassword and click retry button for several times and finally it works.
Updating java-1.7.0-openjdk to java-1.8.0-openjdk will do the trick and restart the jenkins service or else change the port number and try it.
I got the same error on my ubuntu VPC, here is how I solve Unable to connect to Jenkins issue.
In my VPC Nginx is installed. Nginx is listening on port 80 so you need to open the firewall to that port as well.
To open the firewall use the following command:
sudo ufw allow 80.
And run this command sudo ufw status to verify the firewall is opened for port 80
After that, you can get the default web page for Nginx by using your_public_ip:80 and Jenkins by entering your_public_ip:8080.
1.Click on retry
2.Fill admin user name, pwd ,mail, full name
3.If filled already use pwd given in initialAdminPassword folder
4.proceed

Resources