Skip to main content

quick system configuration tool

Project description

A sysplan apply command in the fashion of netplan.

Overview

In /etc/sysplan.d, you can add .yaml configuration files that sysplan will be able to apply on your system. You will be able to generate systemd stuff, add your custom bash modules, and even more complex python modules to infinitely extend sysplan to your taste.

The structure of the yaml file is as such:

plugin_name:
  your-first-plan-name:
    any: config
    for:
    - your
    - plan

Tutorial

Basics and systemd

Try adding the following content into /etc/sysplan.d/example_systemd.yaml:

services:
  sysplan-test-service:
    TEST_ENV_VAR: 2
    Unit:
      Description: Example Service
    Service:
      Type: oneshot
      ExecStart: /bin/bash -c 'echo nice!'
      WorkingDirectory: /tmp

timers:
  sysplan-test-service:
    Timer:
      OnCalendar: '*-*-* 23:00:00'

mounts:
  mnt-backups:
    Unit:
      Description: Mount NFS Share
    Mount:
      What: 172.24.0.5:/srv/backups
      Where: /mnt/backups
      Type: nfs
      Options: defaults
      TimeoutSec: 10
    Install:
      WantedBy: multi-user.target

Then, try the following commands:

  • sysplan diff

  • sysplan apply

  • sysplan destroy

  • sysplan help

Custom bash modules

Add the following to /etc/sysplan.d/bash_example.yaml:

bash_example.sh:
  plan-one:
    somevar: date
    nested:
    - item: /tmp/$plan_name

  plan-two:
    somevar: uname -a

Add the following to /etc/sysplan.d/bash_example.sh:

write() {
    $somevar > /tmp/$plan_name
    cat /tmp/$plan_name
}

diff() {
    if [ ! -f $nested_0_item ]; then
        echo + $nested_0_item TO CREATE
    else
        $somevar | $(which diff) -u $nested_0_item -
    fi
}

activate() {
    echo activated >> /tmp/$plan_name
}

destroy() {
    rm -rf /tmp/$plan_name
}

Then again, play with the sysplan commands.

Builtin modules

files

You can also have files as such:

files:
  /etc/profile.d/pipuser.sh:
    mode: '0755'
    owner: root
    group: root
    content: |
      export PATH=$HOME/.local/bin:$PATH

Custom python modules

Custom Python modules are registered on the sysplan_plans entry points. For example, this is how the systemd plans are registered is setup.py:

entry_points={
    'sysplan_plans': [
        'services = sysplan.systemd:ServicePlan',
        'mounts = sysplan.systemd:MountPlan',
        'timers = sysplan.systemd:TimerPlan',
    ],
},

As such, the pointed python plan classes will be used for the services, mounts and timers keys in sysplan yaml.

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

sysplan-0.0.1.dev28.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file sysplan-0.0.1.dev28.tar.gz.

File metadata

  • Download URL: sysplan-0.0.1.dev28.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for sysplan-0.0.1.dev28.tar.gz
Algorithm Hash digest
SHA256 1b22217e7a0fe3e3db50419823d5783b2825ba7090dd410d8b0a49c8720eb9c3
MD5 fb0751410704e2a6851fc0dd432d00bd
BLAKE2b-256 9aeace1814b02d6f93c74ed00f611bb98d6d44415303907fd479f9eb7b2fa280

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