Skip to content

Instantly share code, notes, and snippets.

View isweluiz's full-sized avatar

Luiz isweluiz

View GitHub Profile
RKE vs RKE2

RKE-image

RKE2, also known as RKE Government, is Rancher's next-generation Kubernetes distribution.

It is a fully conformant Kubernetes distribution that focuses on security and compliance within the U.S. Federal Government sector.

To meet these goals, RKE2 does the following:

  • Provides defaults and configuration options that allow clusters to pass the CIS Kubernetes Benchmark v1.6 with minimal operator intervention
  • Enables FIPS 140-2 compliance

Ansible Inventory report with ansible-cmdb

Ansible-cmdb takes the output of Ansible's fact gathering and converts it into a static HTML overview page (and other things) containing system configuration information.

It supports multiple types of output (html, csv, sql, etc) and extending information gathered by Ansible with custom data. For each host it also shows the groups, host variables, custom variables and machine-local facts.

How to modify a list of dictionaries with Ansible

For the below scenario, what we'are trying to solve to do?

  • Looking for directories and change their permissions
  • Change the permission non-recursive
  • Change just the folder that match with the specific permission

Ansible Modules

Infrastructure as Code is based on a few practices

sketch

  • Use Definition Files: all configuration is defined in executable configuration definition files, such as shell scripts, Ansible playbooks, Chef recipes, or Puppet manifests. At no time should anyone log into a server and make on-the-fly adjustments. Any such tinkering risks creating SnowflakeServers, and so should only be done while developing the code that acts as the lasting definition. This means that applying an update with the code should be fast. Fortunately computers execute code quickly, allowing them to provision hundreds of servers faster than any human could type.

  • Self-documented systems and processes: rather than instructions in documents for humans to execute with the usual level of human reliability, code is more precise and consistently executed. If necessary, other human readable documentation can be generated from this code.

  • Version all the things: Keep all this code in source con

@isweluiz
isweluiz / GitCommitEmoji.md
Created June 8, 2022 11:25 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
### Automating push with just a single bash command
```bash
vim git-push
```
```bash
@isweluiz
isweluiz / jinja-split-line.md
Last active June 4, 2022 14:50
How to remove the line when the variable is not defined in jinja2 template

How to remove the line when the variable is not defined in jinja2 template

I have the JINJA2 template below, and so the issue is that when some variable is not defined the conditional will have just a blank line, this is not what I would expect. See the result below the code and let's try to solve it.

If you wanna to do some live test I really recommend try to use https://j2live.ttl255.com/ .

My template:

@isweluiz
isweluiz / markdown-details-collapsible.md
Created April 13, 2022 10:13 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets

How to switch your ansible version in the same env?

Ansible is just a python package,if you have virtualenv installed on your host it is just a matter of creating a new venv for each ansible version you want, and then pip install it.

First, verify the installed Python version and path. Create a virtual environment using the python3 -m venv <environment-name> command. You can give any name to your Python virtual environment. I want to try the Ansible 2.10 version, so I named it in a way to identify the directory easily:

$mkdir ~/venvs/
$cd !$
$python3 -m venv ansible2.10