Question: How to Schedule Master Node to Run Pod Workloads Like the Worker Node? By default, only the worker node can run the pod workloads and the master is only responsible for the scheduling and configuration. $ kubectl get nodes -o json | jq .items[].spec.taints [ { “effect”: “NoSchedule”, “key”: “node-role.kubernetes.io/master” } ] $ kubectl […]
DevOps
Python Quadratic Formula
An equation with the form ax^2+bx+c=0 is known as a quadratic equation. When plotted on a graph it will take the general shape of the graph seen below. The points at which the quadratic graph crosses the x-axis are known as the solutions of the quadratic equation. For this example, the quadratic crosses the x-axis […]
How to Check if the script is run by root at the start of the script
Check root at start of script Some scripts need to be run as root and you may want to check at the start of that script that it is running as root. This can be done by checking the environment variable $EUID. This variable will hold the value 0 if it’s being run as root. […]
How to use ansible-config to discover and investigate configuration options
Viewing Configuration Options If you want to find out what options are available in the configuration file, use the ansible-config list command. It will display an exhaustive list of the available configuration options and their default settings. This list may vary depending on the version of Ansible that you have installed and whether you have […]
How to write multiple plays and per-play privilege escalation in Ansible
Writing Multiple Plays A playbook is a YAML file containing a list of one or more plays. Remember that a single play is an ordered list of tasks to execute against hosts selected from the inventory. Therefore, if a playbook contains multiple plays, each play may apply its tasks to a separate set of hosts. […]
How to Write Ansible Playbook and run it using the ansible-playbook command
Ansible Playbooks and Ad Hoc Commands Ad hoc commands can run a single, simple task against a set of targeted hosts as a one-time command. The real power of Ansible, however, is in learning how to use playbooks to run multiple, complex tasks against a set of targeted hosts in an easily repeatable manner. A […]
How to Run Ad-Hoc Commands Using Ansible
In this post, we will learn how to run a single Ansible automation task using an ad hoc command and explain some use cases for ad hoc commands. Running ad hoc Commands with Ansible An ad hoc command is a way of executing a single Ansible task quickly, one that you do not need to […]
Unable to run NGINX Docker due to “13: Permission denied”
The Problem The NGINX docker container was started using the below command: # docker run –detach –name nginx_server nginx 4ffbcd5ee796b8cce3f2c6ed4cce8927d2b13a040af07b36f7a866b2157290e8 But user failed to get connection to the NGINX server. Upon troubleshooting user found below error logs: # tail -f /var/log/audit/audit.log type=AVC msg=audit(1565283160.116:316): avc: denied { write } for pid=2387 comm=”nginx” name=”nginx” dev=”dm-0″ ino=140648937 scontext=system_u:system_r:container_t:s0:c345,c550 […]
How to Use user-defined Functions in awk
User-Defined Functions You can create user-defined functions in a awk script file using the func or function keywords. Placement in the file is not important; the function definition can occur anywhere in the awk script. The function can take arguments (local to the function only) or use any existing variable. The syntax of a function […]
Using Loops (while, for) in awk scripts
The awk programming language contains many of the programming concepts that are used in shell scripting. Conditionals, such as the if statement and loops, such as the following can also be used in awk programming. The while loop The do while loop The for loop The if Statement The if statement can have two branches: […]