Operations grimoire/Operations repository

From Nasqueron Agora

Our configuration as code is stores in the operations (rOPS) repository.

Repository layout

Content of rOPS
Path Description
_modules Custom execution modules
_states Custom states modules
_tests Unit tests for custom modules, scripts, tests for repo
config Deprecated. Configuration files for other configurators
hotfixes Fixes you need to run to solve a problem on the servers
pillar Configuration data structures to use in the states
roles The states to deploy, divided in roles and then in units
scripts Deprecated. Scripts from before we used Salt
utils Helper scripts to maintain the repository
map.jinja As we deploy on several OS and distros, mapping of packages names or directories
top.sls topfile: what we deploy where?
PORTS Documentation of the ports used in the configuration
UIDs Documentation of the users used in the configuration
GIDs Documentation of the groups used in the configuration

Contributions howto

Repository source

You'll find the Operations repository at https://devcentral.nasqueron.org/source/operations/

If DevCentral isn't available, a mirror of the repository can be found at https://github.com/nasqueron/operations.

Workflow of contributions

We follow the general workflow is described at How to contribute code.

Before committing a change to the main branch, you can test a deployment on a server. In that case, merge in main immediately after the deployment as the repository is the source of truth for the server state.

Log what you do on #nasqueron-ops, so it will be included at https://infra.nasqueron.org/servers-log/

Code conventions

See also: Code conventions'

  • Python code: run `black` before committing
  • YAML: indent with two spaces, including list bullets
    - somekey: value
    - otherkey: value

IDE configuration

Screenshot of correctly configured template languages

The states .sls file are Jinja2 templates producing YAML files, or "jinja2+yaml". If this case can't be handled by your IDE, it works best to use YAML syntax highlighting.

If you use PyCharm or IntelliJ IDEA Ultimate, you can configure this scheme:

  • Allow YAML files to be Jinja2 templates
    • Go to Settings > Languages & Frameworks > Template Languages
    • Select Jinja2 as template language
    • Add YAML in the list
  • Open SLS as YAML