Skip to main content

Configurator

Welcome to the Configurator! Configurator is a Python-based command line interface (CLI) which issues commands based on user-defined "tasks" to "hosts" over SSH.

Installation

Option 1: Install from TestPyPI

  1. Install the configurator: pip install atkinsonm-configurator

Option 2: Install from Source

  1. Clone this package.
  2. cd part-two.
  3. sudo python3 setup.py.
  4. Run atkinsonm-configurator --help to confirm the install.

Using the Configurator

atkinsonm-configurator --help is your friend.

Configuring Hosts

atkinsonm-configurator host --help lists commands for managing hosts. You can also manage the hosts file by hand. See samples/hosts.yaml for examples.

At this time we support password authentication only and assume the password is for the root user. We only support specifying hosts by IP address at this time.

The hosts must have a root user, must allow logins to the root user using password authentication, and must be accessible over SSH. No other dependencies are required for installation on target hosts (and therefore no bootstrap.sh is provided with this package).

Configuring Tasks

Modify the hosts file (YAML format, default location /home/$USER/configurator-tasks.yaml) by hand using the supported task types below. The format of the file is a top-level key called tasks which is a list of task definitions.

See samples/tasks.yaml for examples.

Tasks are executed in the order they are defined. Define related task dependencies before successors.

Shared Properties

All tasks have these properties.

  • name: str

Tasks which support specifying a service to restart have these additional properties:

  • restart_service (str): the name of a service to restart with service <service-name> restart

Supported Task Types

File

Create files, set content and metadata

This will replace any files/contents already present at specified locations. Use with caution.

  • type: file
  • path (str): absolute path or relative path (from the root user's home directory) of the file to create
  • contents (str): the file contents
  • owner (str) the file owner (user)
  • group (str) the file owner (group)
  • mode (int) the file mode
tasks:
- name: hello
  type: file
  path: /root/hello
  contents: hello!
  owner: root
  group: root
  mode: 644

Escape single quotes in contents.

File Remove

Removes a file at the specified path.

  • type: file_remove
  • path (str): absolute path or relative path (from the root user's home directory) of the file to remove
- name: remove default index
  type: file_remove
  path: /var/www/html/index.html
Package

Installs and uninstalls packages (apt support only)

  • type: package
  • install (bool): True or False. True means install, False means uninstall
  • package_name (str): the name of the package

Running Commands

Use atkinsonm-configurator task run to run all tasks on all hosts in sequence.

Configuring an Ubuntu Server with Apache and PHP

samples/webserver-tasks.yaml has tasks to set up an Ubuntu server to install Apache and PHP and run a Hello World program in PHP. To run it:

  1. Install atkinsonm-configurator (command above)
  2. Copy the contents of samples/webserver-tasks.yaml to a local file (e.g. /home/$USER/webserver-config.yaml)
  3. Configure hosts per instructions above (hosts file not included here for security reasons)
  4. Run atkinsonm-configurator task run -t /home/$USER/webserver-config.yaml
  5. Test your new webserver with curl -sv "http://ADDRESS"

Future Improvements

There are a number of improvements I would make to this application given more time. Many TODOs are called out in code comments. I will highlight a few significant ones here:

  • Support authentication other than root user
    • Privilege escalation (sudo) where necessary for non-root users
  • SSH key-based authentication
  • Support for other package managers
  • General code cleanliness

Metadata

Release files for atkinsonm-configurator 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atkinsonm-configurator 0.0.4
File Size Uploaded Provenance
atkinsonm-configurator-0.0.4.tar.gz 7.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for atkinsonm-configurator 0.0.4
File Interpreter ABI Platform
atkinsonm_configurator-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / atkinsonm-configurator-0.0.4.tar.gz

Download URL atkinsonm-configurator-0.0.4.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9e3943dea62e2d1b7fdc5f82598eac5be4f917d0c5d94246f9742ce1c3fbcb0c
BLAKE2b-256 checksum
How to use checksums
acc4aa3a9aca0d3377188bf93ca717775dc7a85346ed1bb0e1d49fa6e9c45986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / atkinsonm_configurator-0.0.4-py3-none-any.whl

Download URL atkinsonm_configurator-0.0.4-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e4c51da059a36f8f84c9a0e15bd79850ef1900e5d80205f3f352ab2a10c4767
BLAKE2b-256 checksum
How to use checksums
c22d149d37811d2f781925099e30144524770773cf60a8529c16919299e8988e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Security for atkinsonm-configurator 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page