What is a group_var or Group Variable in Ansible?

Question
You have heard of Group Variables in Ansible. What are they?

Answer
They are like global variables assigned in a modular way (like Ansible roles). They are ideal when you have Ansible playbooks that run against many different servers. Rather than have a regular variable in a playbook, group variables are taken from a group_vars/ directory. To read more about them,

How Do You Create a File on a Server with Terraform?

Problem scenario
You are trying to get user data to create a file on a server in Terraform. It is in a directory that requires sudo privileges. You use the “sudo” command in the Bash script. The Bash script executes except a file is never transferred. How do you get Terraform to copy a file to a new server?

Solution
Use the Terraform-supported cloud_config option instead of having a Bash script transfer the file.

How Do You Install Windows DSC on Windows Server 2019?

Problem scenario
You are running Windows Server 2019. You want to install Windows DSC. What do you do?

Solution

  1. Open PowerShell.
  2. Run this command: Install-Module ‘PSDscResources’ -Verbose
  3. When prompted with this question “NuGet provider is required to continue…”, choose “Yes”.
  4. If you believe your Windows Server is in a secure environment, or you have no goals putting sensitive data on your Windows server,

How Do You Get Chef to Be Automatically Installed and Configured (e.g., in a Docker Container)?

Problem scenario
You have a Docker container that supports Chef or some automatic way of installing Chef. The automation is failing at the end because you are being prompted to accept a license. What should you do to be able to invoke Chef commands automatically?

Solution
With the first Chef command, e.g., “chef env”, use the “–chef-license accept” option/flag. Here is an example:

chef env –chef-license accept

For more information,

How Do You Install “inspec” with gem from the Command Line?

Problem scenario
You want to install the inspec gem. What do you do?

Solution
Run this:
gem install inspec
(Taken from https://mitre-inspec-developer.netlify.app/installation/linuxinstall.html )

Does the inspec-bin command work? This may be a newer version that is already installed.

If you installed Ruby with root, which is not recommended according to https://stackoverflow.com/questions/24706277/error-sudo-gem-command-not-found,