How Do You Get Your GPS to Get Traffic and Show Your Position Properly?

Problem scenario
Your GPS is not working properly.  The traffic updates and satellites for the maps are not working correctly.  What is wrong?

Possible solution #1
The cord should be unravelled.  They often are supposed to work as antennas.  Bundled up the cord may not work as an antenna.  Place as much of the cord along the dashboard as possible.  This way there is a clear path to the sky.

Possible solution #2
You are underground or in a tunnel.  You may have lost the signal that way.  When you get out of the tunnel, you may get the latest information again.

Possible solution #3
You have driven out of your GPS's map regions.  Many GPSes only have a subsection of the country.  You may need to change the maps on your device.  But this will take time and you will lose some regions of the maps that you had.  To overcome a restriction of space on your GPS, you may want to buy a micro SSD card to insert into your GPS to get more maps saved on your device.  In the long run you can save time this way.

Possible solution #4
Purchase a new GPS here.

How Do You Delete the Git Credentials You Entered Into Jenkins for “Source Code Management”?

Problem scenario
In a Jenkins job there is a "Source Code Management" section.  You checked Git and entered credentials.  You entered the same username twice (or more).  Now you want to delete some of those users to be able to know which (unique) password is being used.  What should you do?

Solution
It isn't always easy to find where the credentials for your Git repository are stored.  There are different ways of finding them.

Possible solution #1
Go to the home page of Jenkins.  Then go to "Credentials".  (It is not Git-based.  You can see this link for more information.)

Possible solution #2
Go to the home page of Jenkins.  Go to another master.  Then go to "Credentials".

Possible solution #3
Go to the home page of Jenkins.  Go to a project folder (for the job of the credentials you want to change).  Then go to "Credentials".

Possible solution #4
Go to the home page of Jenkins.  Go to the job of the credentials that you want to change.  Then go to "Credentials".

How Do You Install Gatling on a CentOS/RHEL/Fedora server?

Problem scenario
You are using a Red Hat derivative of Linux.  You want to install Gatling.  What do you do?

Solution
Prerequisite

Install Java.  If you need assistance, see this posting.

Procedures
1.  Run a script with the following content (e.g., name it installgatling.sh and run sudo bash installgatling.sh):

gatlingversion=3.3.1    # change this version as needed.  Go to gatling.io for the latest details.
curl -L https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/$gatlingversion/gatling-charts-highcharts-bundle-$gatlingversion-bundle.zip > /tmp/gatling-charts-highcharts-bundle-$gatlingversion-bundle.zip

yum -y install unzip
cd /tmp/
unzip gatling-charts-highcharts-bundle-$gatlingversion-bundle.zip
mv gatling-charts-highcharts-bundle-$gatlingversion /opt/gatling
echo "Now go to the /opt/gatling/bin/ directory and run gatling.sh with 'sudo bash gatling.sh'"

2.  These are optional steps if you want Gatling's results to be presented in a web UI:

Gatling provides visual results of its stress tests.

Install and configure either Apache Web Server of Nginx on the Gatling server.  If you want assistance, see this posting for installing Apache Web Server on a CentOS/RHEL/Fedora server.  For a Debian/Ubuntu server, see this posting to install Apache Web Server.  If you want assistance on installing Nginx, see this posting.

After the gatling.sh script runs it should indicate where the results are.  It will say something like this: "Please open the following file: /opt/gatling/results/basicsimulation-1530041190858/index.html"

Find out where your default directory is for your webserver.  The file would be httpd.conf for Apache web server on a Red Hat distribution of Linux (e.g., CentOS or Fedora).  The file would be apache2.conf for Apache web server on a Debian/Ubuntu distribution of Linux.  The "DocumentRoot" stanza would signify where the directory is.  It may look like this:

DocumentRoot "/var/www/html/"

For these examples, you would run these commands to get the results as web presentable:

sudo mkdir /var/www/html/gatling
sudo cp -R /opt/gatling/results/basicsimulation-1530041190858/ /var/www/html/gatling

Open the web browser and go to http://x.x.x.x/gatling/index.html to view the results (where x.x.x.x is the external IP address of the web server).

How Do You Set up an nfs File Share between Two Linux Servers in GCP?

Problem scenario
You want to be able to share a directory between two Red Hat distribution Linux servers.  How do you expose an NFS share on one Linux server and make it viewable for reads and writes from a second Linux server?

Solution
Prerequisites
You have install nfs-utils on both servers.  To do this, run this command:  sudo yum -y install nfs-utils

Procedures
Designate one server to host the nfs server.  This will be the "nfs server."  Designate the other server as the client of the nfs server (or "nfs client").  In GCP we found that using the internal IP addresses worked well when the directions below call for a server IP address.  But you may adapt this solution to a non-GCP pair of servers.

1.  From the nfs server, do the next three steps (through step #4).
2.  Make the directory that will be exported as an nfs share (e.g., sudo mkdir -p /usr/bin/contint).
3.  Modify the /etc/exports file (or create one if necessary).  Add a line like this (but replace x.x.x.x with the IP address of the nfs client server and replace "/usr/bin/contint" with the directory created in step #2):

/usr/bin/contint x.x.x.x(rw,sync,no_root_squash)

4.a.  Run this command:  sudo service nfs start

4.b.  If you want the nfs service to be available after a reboot, you will have to do this:

sudo crontab -e   # to modify the crontab.  add the line below then save it (usually by pressing the Escape key then uppercase Z twice, e.g., Esc ZZ)

@reboot sudo service nfs start

5.  Log into the nfs client server.  Run the following commands from the nfs client server.   
6.  Make a directory that will be the place where you read and write to the nfs file share.  Here is an example:  sudo mkdir -p /usr/bin/viewable

7.  Run this command but replace x.x.x.x with the IP address or hostname of the nfs server: sudo showmount -e x.x.x.x

8.  Compose a command like this, but make three replacements as described below it:

sudo mount -t nfs x.x.x.x:/dir/path/above /usr/bin/viewable

i.  Replace "x.x.x.x" with the IP address or hostname of the nfs server.
ii.  Replace "/dir/path/above" with the directory referred to in the results from step #7.  
iii.  Replace "/usr/bin/viewable" with the directory you created in step #6 above.

9.  Run the command composed above.

10.  Verify it work by running this:  ls -lh /usr/bin/viewable

11.  If you want the nfs share to be usable after a reboot of the client, run a command like this: echo 'sudo mount -t nfs x.x.x.x:/dir/path/above /usr/bin/viewable' >> ~/.bashrc

(Remember to replace "sudo mount -t nfs x.x.x.x:/dir/path/above /usr/bin/viewable" with the command composed in step #8.)

How Do You Troubleshoot the Ansible Error “Unsupported parameters for (copy) module: become Supported parameters”?

Problem scenario
You are trying to run an Ansible playbook with the "become: yes" stanza.  You get this error after your ansible-playbook command:

fatal: [instance-11]: FAILED! => {"changed": false, "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "msg": "Unsupported parameters for (copy) module: become Supported parameters include: _original_basename, attributes, backup, checksum, content, delimiter, dest, directory_mode, follow, force, group, local_follow, mode, owner, regexp, remote_src, selevel, serole, setype, seuser, src, unsafe_writes, validate"}

Solution
Unindent the "become: yes" stanza so it is at the same level of its corresponding module.

Here is an example of an incorrect indentation:

- hosts: all
  tasks:
  - copy:
      src: /home/cooluser/swapspace.sh
      dest: /home/cooluser/swapspace.sh
      owner: cooluser
      group: wheel
      mode: 0644
      become: yes

Here is an example of a correct indentation:

- hosts: all
  tasks:
  - copy:
      src: /home/cooluser/swapspace.sh
      dest: /home/cooluser/swapspace.sh
      owner: cooluser
      group: wheel
      mode: 0644
    become: yes

How Do You Iterate through a List of Servers When Running an Ansible Playbook?

Problem scenario
You want an Ansible playbook to run on specific managed nodes.  You can create a list of the servers you want the playbook to apply to.  How do you provide a list of specific hostnames and have the Ansible playbook run on each server?

Prerequisites
This assumes that you have installed Ansible and have it working with the managed nodes you want to run a playbook on.  For directions on deploying Ansible, see this posting.

Procedures
You could modify the inventory file on your Ansible server.  But if you want a list for an ad hoc run of an Ansible playbook, do the following:

1.  In the .yaml or .yml file of your playbook, create a stanza like this:

hosts:  coolgroupofservers

2.  Create a file with an arbitrary name in the same directory as your playbook.  Call it something like foobar.txt

3.  Have foobar.txt have the following content:

[coolgroupofservers]
FQDN1
FQDN2
FQDN3

4.  Run the Ansible playbook (e.g., goodpb.yaml) with the -i flag to call the foobar.txt file:

ansible-playbook goodpb.yaml -i foobar.txt

How Do You Browse SonarQube and Interact with It as a Web UI from the Front-End?

Problem scenario
You run a "sudo ps -ef | grep sonar" and find Sonar to be running.  You run "sudo sytemctl status sonar" and find that it is active.  You run nmap or netstat and see port activity from the sonar service.  Sonar is listening.  When you go to a web browser over the right port (e.g., http://x.x.x.x:9000/) you do not see any web page.  There is no evidence you can connect.  How do you log into SonarQube via a web browser?

Solution
Use "/sonar" in the URL.  Rather than a program like Jenkins, the URL may need to be constructed with a "/sonar" appended to it like this:

http://x.x.x.x:9000/sonar

#  Where x.x.x.x is the external IP address of the server.  You can find it by running this command from the back-end: ip addr show | grep inet

You will ignore the 127.0.0.1 from the results.  You can change the base URL in sonar.properties.  If you want to do this, see this posting.

How Do You Eliminate the “Namespace”, Quotes and Brackets from the Variable You Are Printing with Python?

Problem scenario
You are trying to print a variable, but it prints out like this:

Namespace(string=['foobar'])

How do you print out just "foobar" with no quotes?

Solution

Overview
The key word here is "string".  The "string" text in this is the attribute you will want.

Background
Your program may have something like this:

args = parser.parse.args()     # Assuming this is the variable assignment of "foobar"
print (args)     

 Procedures
1.  Eliminate the "print(args)" line.

2.  Insert these lines into your code:

var1 = args.string  # this retrieves the string attribute per the "string" that was printed out
newvar = var1[0]    # This retrieves the content of the item without the quotes and brackets.
print (newvar) 

How Do You Troubleshoot the Artifactory REST API Error of a Hanging Command?

Problem scenario
You issue a call to an Artifactory URL.  You see something like this: "TCP_NODELAY set".  There is a delay, and nothing happens.  What should you do?

Solution
Does the URL have a port number in it?  The socket may be incorrect depending on what port number you use.  If you can go to the back-end of the Artifactory and install nmap, run this command to find what port Artifactory listens on:

nmap -Pn x.x.x.x  # replace x.x.x.x with the external IP address of the Artifactory server

Make sure the URL you use has the correct port number for Artifactory.

If you need assistance installing and configuring Artifactory for the first time, see this posting.

How Do You Install a Yum Package from a Reachable yet Unconfigured Repository on an Ad Hoc Basis?

Problem scenario
You want to install a package with a yum command.  But you receive an error about the package not being available.  You know that a reachable, yet unconfigured, repository has the package.  You know the repository's name too.

You cannot use "subscription-manager register" to configure a new repository because you do not have the proper credentials or there is a firewall blocking the Red Hat derivative Linux server.  What should you do to install a package from a different repository on a one-time basis?

Solution
Run a command such as this:
sudo yum install foobar --enablerepo=SPECIAL_REPO

# replace "foobar" with the package you want to install
# replace "SPECIAL_REPO" with the name of the repo that has it.