Skip to main content

Pets not cattle. A straightforward way to manage configuration files.

Project description

Hamstercage – Config Management for Pets, not Cattle

Overview

If you work professionally with many machines and config, you like will have heard "cattle, not pets" as the philosophy for managing machines, VMs, etc., and you're likely using Ansible, Puppet, SaltStack, or another configuration management system that allows you to express configuration as code. This approach works well when you have many targets that share many traits, you have a lab where you can test configuration changes, and you have full time staff to take care of it all.

However, if you're running a handful of boxes or VPSes for a small organisation, or just for yourself and your friends and family, your workflow might actually look quite different: you make changes to the live configuration of your web server, for example, and after you're satisfied that everything is working, you might want to save the key bits of config somewhere safe, so you can refer back to it later. Setting up any of the heavy tools can be cumbersome, especially for making quick provisional changes: in the worstcase scenario, you modify a file in the source repo, commit it, then run the tool to apply it to your machine.

Hamstercage aims to make it easy to save and restore your config by using a Git repo, by editing the config files directly on the target machine, then saving the new config into the repository. In other words: pets, not cattle.

Hamstercage is geared towards managing config files as complete files. To keep things simple, there are no facilities to update individual lines in files, update system configuration settings through some API, or other more complex logic. Hamstercage can be used to manage shell script files or binaries for custom tools, however.

To allow one repository to be used for multiple targets, sets of files can be managed. Each set is called a tag. You can select the tags to use each time you run Hamstercage. The manifest also contains a list of hostnames and the tags to use for each. This makes it possible to run the same Hamstercage command on multiple hosts, and have files be applied to each according to their respective purpose.

Installation and Usage

See Hamstercage Documentation and the Hamstercage Homepage.

Quick Start

pip install hamstercage
mkdir hamsters
cd hamsters
git init
hamstercage init
hamstercage -t all add /etc/profile
git add .
git commit

Developing Hamstercage

Poetry For Dependency Management and Building

The project uses Poetry, which you should install locally. After installing Poetry, you can install all necessary dependencies:

poetry install

Source Code Formatting With Black

The GitHub workflow checks source code formatting with black.

To format all code automatically:

poetry run black .

When working on the code, you might want to configure your IDE to automatically reformat the code with black.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hamstercage-0.1.0.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

hamstercage-0.1.0-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file hamstercage-0.1.0.tar.gz.

File metadata

  • Download URL: hamstercage-0.1.0.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.13.0-1025-azure

File hashes

Hashes for hamstercage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e9d9b25fa24b88c91488a8b7987f25a2a6dc1fc6e8b25d729e030fa43f14e13
MD5 010c1e2f4905fbc26df08c3a2fa9ab16
BLAKE2b-256 0fdb872485da40107dc4adeb93622b0ab0fa546b7c8f7020c8cd4af10baf0bc4

See more details on using hashes here.

File details

Details for the file hamstercage-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hamstercage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.12 Linux/5.13.0-1025-azure

File hashes

Hashes for hamstercage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 221251b93e9ec508816a320b57672cf030ecaf9e9f997892d886cd41463253a8
MD5 698e0373c5d6fb1d4d09d5e89a67b2fd
BLAKE2b-256 c913b6a423e433d4154ca45792c6995fc06b83f7243a1e9fab07cbe4bf9a2371

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page