How Do You Troubleshoot a C Program That Prints a Warning Message like “expects argument of type ‘char*’, but argument 2 has type ‘int’ [-Wformat=]”?

Problem scenario
You compile a C program (with gcc foobar.cc) but you get an error message like this:

“foofbar1.cc:71…: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘int’ [-Wformat=]
   printf (“y is a %s\n”, y);
                           ^  “

What do you do to not get this error?

Solution
While the code compiles, the executable may not run. 

How Do You Write an Ansible Playbook to Transfer a Compressed File and Unzip It without Using Linux Utilities?

Problem scenario
You have installed Ansible and configured it to work with other servers (managed nodes).  You want to write an Ansible playbook that will work with Linux managed nodes with three requirements:

1.  Transfer a compressed file from a web sever without wget.
2.  Uncompress a .zip file without unzip.
3.  Work without passwordless SSH authentication to the managed nodes.

How do you accomplish this with using Ansible-supported features?

What is GitOps?

Question
What is GitOps?

Answer
GitOps is a declarative method of managing infrastructure that is driven by committing code into a version control system. GitOps is an indirect, and usually imperative, approach to systems administration that gives a detailed history of past operations.  GitOps is the practice of adding code to a Git repository to trigger an operational event (such as rebooting a server, creating a user account,

How Do You Get the SonarQube Service to Remain on when It Stops Shortly after Being Started?

Problem scenario
You start SonarQube and the service seems to come up.  You see TCP port connection activity.  It does not stay up long enough to log in.  

You have SonarQube installed on a Linux server.  SonarQube starts, but it does not remain running because it dies out.  It stops running after 30 seconds of being started.  

In /opt/sonarqube/es.log you see a message like this:  “2018.05.23 17:01:53 WARN 

How Can Conway’s Law Avoid Conflicting with the DevOps Movement?

Organizational structures are created by business leaders.  A constellation of specialists in theory can be very productive for modular codebases where the work is distributed intelligently.

Conway’s Law is “[a]ny organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization’s communication structure.” Conway’s Law indirectly asserts that the Unix philosophy of having things be modular is achievable best by loosely-coupled groups rather than tightly-coupled groups (such as an aggregation of mini-groups into one business unit) according to WhatIs.com.

What Command Do You Run to See the Host Variables That Ansible Natively Has Access to on the Servers In /etc/ansible/hosts File?

Problem scenario
You want to see the different variables that Ansible can leverage (e.g., for playbooks to inject host-specific data into files).  How do you find out what Ansible has access to on each server in /etc/ansible/hosts?

Solution
Run this command:
ansible all -m setup –tree /tmp/facts

How Do You Troubleshoot a Crontab Problem?

Problem scenario
You have modified the crontab (e.g., with sudo crontab -e), but the job is not running.  What can you do?

Possible Solution #1
A good troubleshooting technique of a cronjob is to configure it to have this job * * * * * env /tmp/list.txt. You then analyze /tmp/list.txt to see if it is different from the results of running “env” manually.

How Do You Troubleshoot the openssl Error “getaddrinfo: Servname not supported for ai_socktype”?

Problem scenario
You use the openssl command, but you receive an error.  You run a command such as this:

openssl s_client -connect https://www.continualintegration.com:80

You get a message such as this:
getaddrinfo: Servname not supported for ai_socktype
connect:errno=0

What should you do to view the SSL certificates?

Solution
Run the command without the “http://”.  Here is an example of the correct syntax:

openssl s_client -connect continualintegration.com:80

For Future Reference
OpenSSL uses SSL and TLS. 

How Do You Search a Directory in Linux for Files That Have Content That Match a Pattern?

Problem scenario
Linux novices call directories “folders.”  You want to search all the directories and subdirectories for a string pattern.  How do you do this?

Solution
1.  Change directories into the directory where you want to start searching.

2.  Run this command:  grep patterntosearchfor * -ir

Replace “patterntosearchfor” with the pattern you want to find.  Use all lower case. 

How Do You Remove a File from a Git Repository so the Old Versions Are Eliminated?

Problem scenario
You accidentally uploaded a file with sensitive data (e.g., hard-coded credentials such as a database username and password) to a Git repository.  You want to eliminate it from the Git repository so all of its history are removed from the previous commits and it is unretrievable.  How do you do this?

Solution
WARNING:  This will delete data.  Some people rely on Git repos as a disaster recovery product.