What Do You Do when an Ansible Playbook Is Not Removing a File or Directory or Unmounting a Directory when There Are No Errors?

Problem scenario
You run a playbook, and there are no errors.  But the playbook’s simple logic is not working.  The file or directory is not being eliminated.  Or the unmount of the directory is not working via the mount module.  What should you do about a silently failing playbook?

Solution
1.  Verify there are no [trailing] spaces in the directory path.  If you accidentally quote a space after the last subdirectory or file,

 » Read more..

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.

 » Read more..

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:

     

 » Read more..

How Do You Use a Dictionary in Python?

Problem scenario
You want to use a dictionary in Python, but you do not know how. What should you do?

Solution
1.  For a very simple dictionary, you could use “{}” with no quotes.  This makes var1 a dictionary in Python:

var1 = {}

Normally with no colons, two matching curly braces would signify a set.  (You can find out more about this Python syntax 

 » Read more..

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. 

 » Read more..

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,

 » Read more..

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”). 

 » Read more..

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. 

 » Read more..

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). 

 » Read more..

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):    

 » Read more..