Why Is a GitLab Webhook That Integrates with Jenkins Failing with a “500 …instance_identity.InstanceIdentity.get …” error?

Problem scenario
A GitLab webhook (aka integration) fails.  It used to work as an integration mechanism with Jenkins.  The GitLab error message says:

“500 <!DOCTYPE html> … at org.jenkinsci.main.modules.instance_identity.InstanceIdentity.get(InstanceIdentity.java:133)”

Solution
Go to the Jenkins server and reinstall the GitLab plugins.

How Do You Troubleshoot the Ansible Playbook Error “fatal: FAILED! => {“msg”: “The conditional check “?

Problem scenario
You run an Ansible playbook that uses a variable, but you get the message “fatal: FAILED! ={“msg”: “The conditional check …The error was: error while evaluating conditional (ansible_hostname == ):”.  What should you do?

Solution
When testing a variable’s value to another fixed string, put quotes around the string.  

Here is an incorrect example of a playbook using such a comparison:

     

How Do You Troubleshoot the Git Error Fatal Foobar.Git Does Not Appear to Be a Git Repository?

Problem scenario
You run a git command and you get an error like this:

“fatal: ‘root/contint.git’ does not appear to be a git repository
fatal: Could not read from remote repository.”

The git command works on the server with the git repository.  But from another server you get the error above.  What should you do?

Solution
Find the full path to the git repo file. 

How Do You Use Amazon DynamoDB?

Problem scenario
You want to use a NoSQL solution from a public cloud provider. How do you deploy Amazon DynamoDB to try it out?

Solution
1.  Log into AWS.
2.  In the web browser, go to https://console.aws.amazon.com/dynamodb/home
3.  Click “Create table”
4.  Enter the fields as you find appropriate.  It should be self-explanatory.  Click “Create”.
5.  You can now create items in the table,

How Do You Troubleshoot SonarQube Not Working when the Logs Have a Comment about Not Being Able to Connect to the Database?

Problem scenario
In the SonarQube logs you get an error “java.lang.IllegalStateException: Can not connect to database.  Please check connectivity and settings (see the properties prefixed by ‘sonar.jdbc’)”

How do you troubleshoot this error?

Solution
1.  Verify you can ping the hostname.  

2.  Test the port with nmap (e.g., “nmap -p 1521 <databaseFQDN>” where <databaseFQDN> is the hostname of the database and 1521 is the port you configured in the stanza with “sonar.jdbc”). 

How Do You Delete a Directory on Linux Server That Is Not Easily Deleted?

Problem scenario
You are trying to remove a directory.  When you run a “sudo rm -rf” command you get this error:

rm: cannot remove ‘/path/to/’: Device or resource busy

When you run a “sudo umount /path/to/” command you get this error:

“umount.nfs: device is busy”

What should you do to eliminate the directory?

Solution
1. 

How Do You Use a Jenkins Pipeline with a Scripted Syntax?

Updated and re-tested on 9/24/19
Problem scenario
You read about what Jenkinsfiles are.  Coveros.com defines them as ‘Jenkinsfiles, using a domain specific language based on the Groovy programming language, are persistent files that model delivery pipelines “as code”, containing the complete set of encoded steps (steps, nodes, and stages) necessary to define the entire application life-cycle.’

You want to use a Scripted Pipeline in Jenkins (via a Jenkinsfile). 

How Do You Indent a Block of Lines in vi The Same Amount?

Problem scenario
You want several lines to be indented by four more spaces automatically.  You do not want to do it manually line-by-line.  How do you indent multiple lines uniformly with the same number of spaces (regardless if they are indented similarly or dissimilarly)?

Solution
1.  Open the file in vi.
2.  Enter this command and press enter afterwards (but replace “4” with the number of spaces you want in your indentation):    

How Do You Troubleshoot the Ansible Error “this task includes an undefined variable”?

Problem scenario
You are running an Ansible playbook, but you get the error “this task includes an undefined variable.”  Every variable seems to be defined.  What is wrong?

Possible solution #1
Do one of the variables rely on an index of server names?  If the playbook orchestrates something that responds to Ansible values on other servers and one server is not reachable,