Install Ansible on Ubuntu – APT Repository

Ansible is a popular agent-less automation tool used to configure local or remote systems and deploy applications.

The easiest way to install the latest version of Ansible on Ubuntu is to get it from the official APT repository.

This short note shows how to install Ansible on Ubuntu, check its version, locate the configuration file and test the connection to a remote host from the command line. (more…)

Ansible: Human-Readable Output Format

By default Ansible sends output of the plays, tasks and module arguments to STDOUT in the format that is not suitable for human reading.

Starting from Ansible 2.5, the default output format can be changed to a human-readable using the callback plugin.

This short note shows how to change the default Ansible’s JSON output format to the more human-friendly YAML format. (more…)

Pip: Install Requirements – Exclude Specific Packages

The requirements.txt file that contains the Python application dependencies is usually generated by developers using the pip freeze > requirements.txt command.

If you install dependencies with the pip install -r requirements.txt command as a part of some automated pipeline or a Dockerfile and you have an issue with some of the dependencies, you may wonder how to exclude and not to install the packages that cause the issue.

In this note i will show how to exclude the specific packages while installing the Python dependencies using the pip install -r requirements.txt command. (more…)

Docker Compose: Specify Dockerfile Path – Example

The docker-compose build or docker-compose up --build commands read the docker-compose.yml file looking for all services containing the build configuration option and run a docker build command for each of them.

If the Dockerfile has been renamed or placed out of the context directory, you can specify the alternate path in the Docker Compose file.

Below i will show an example of how to specify the alternate path to the Dockerfile in the build section of the Docker Compose file. (more…)

Jenkins: Hide Passwords – MaskPasswordsBuildWrapper

For some reason you may not want to store credentials in Jenkins using the Credentials Plugin.

Nevertheless, you still may need to hide sensitive data, like passwords or secret keys from the console output in Jenkins.

One of the possible solution is to wrap the parts of the code you want to hide with set +x (stop showing the output) and set -x (resume showing the output).

But the more elegant and efficient solution is to use the Mask Passwords Plugin, that allows masking passwords that may appear in the console.

In this note i will show an example of how to hide passwords in Jenkins console output using the MaskPasswordsBuildWrapper from the Jenkins declarative pipeline. (more…)

Jenkins Pipeline: Input Step – Example

In Jenkins declarative pipelines it is possible to prompt a user for an interactive input by creating the input step.

For example, at some stage of the Jenkins pipeline you may want to ask a user to provide the credentials.

The user input can be saved as an environment variable and used in the next steps.

Bellow i will show an example of the Jenkins pipeline with the input step. (more…)

Ubuntu: Desktop Shortcut Creation

This note describes two methods of how to create a desktop shortcut in Ubuntu from the command line.

The simplest method is to create the desktop shortcut as a symbolic link using the ln command.

The second method is a bit more complex but it allows to create much more customizable desktop shortcuts using the “Desktop Entry Specification”. (more…)

Batch File Comment (Remark) – Windows

A batch file (batch script) in Windows is a text file that typically has a .bat extension and includes one or more command prompt commands.

It is a good practice to comment a source code in a batch file by leaving the remarks that explain functionality of some lines or blocks of code.

Also any line or a block of code in a batch file can be disabled by turning it into a comment (comment out) and enabled back (uncomment).

This note shows how to comment batch files in Windows. (more…)