From 87ddb813361b903f94cb0102047f5d53195d9203 Mon Sep 17 00:00:00 2001 From: Sean Wilbur Date: Tue, 9 Sep 2025 14:51:15 -0500 Subject: [PATCH] Build base command --- .justfile | 8 ++++++++ .python-version | 1 + README.md | 33 +++++++++++++++++++++++++++++++++ inspector | 3 +++ install.sh | 34 ++++++++++++++++++++++++++++++++++ pyproject.toml | 26 ++++++++++++++++++++++++++ requirements-dev.lock | 32 ++++++++++++++++++++++++++++++++ requirements.lock | 32 ++++++++++++++++++++++++++++++++ 8 files changed, 169 insertions(+) create mode 100644 .python-version mode change 100755 => 100644 inspector create mode 100644 pyproject.toml create mode 100644 requirements-dev.lock create mode 100644 requirements.lock diff --git a/.justfile b/.justfile index e69de29..4b0e64f 100644 --- a/.justfile +++ b/.justfile @@ -0,0 +1,8 @@ +# set dotenv-load := true +set shell := ["bash","-eu","-o","pipefail","-c"] + +setup: + rye sync + +run: + rye run ansible localhost -m ansible.builtin.setup diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..f3fe474 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12.9 diff --git a/README.md b/README.md index e69de29..14caa03 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,33 @@ +# Inspector + +Simple utility that will inspect your local system and report on that. + +This is expected to be run from a debian 13 live cd and requirements are tailored to that. This +is an extension to existing information with standard tools and immediatley gain insights from the +resources on the current machine. + +Data sources: + + * [Ansible]() + * `lshw` + * /proc + +## Installation process + +Calling `install` will bootstrap the environment in an idempotent way. But will enable the local +workflow and python environment for the inpector to work in. + +This will bootstrap the installation of `Justfile`, `git`, `rye`, and use `rye sync` for managing +the workspace dependencies while providing a very simple entry point across the various commands. + +## Usage + +$ ./install.sh + +Prepares environment for use. + +$ just scan + +New inspection result -. The report is the raw text of the process. + +$ just summarize \ No newline at end of file diff --git a/inspector b/inspector old mode 100755 new mode 100644 index e69de29..cd856df --- a/inspector +++ b/inspector @@ -0,0 +1,3 @@ + +if __name__ == "__main__": + print("CLI call") \ No newline at end of file diff --git a/install.sh b/install.sh index e69de29..e8e8282 100755 --- a/install.sh +++ b/install.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# system dependencies +sudo apt update +sudo apt install -y git + +# Install just if not found +if ! command -v just &> /dev/null +then + echo "just not found, installing..." + sudo apt install -y just +else + echo "just is already installed." +fi + +# Install rye if not found +if ! command -v rye &> /dev/null +then + echo "rye not found, installing..." + # The official rye installation script + curl -sSf https://rye-up.com/get | bash + # Source rye's env to make it available in the current shell for this script + source "$HOME/.rye/env" +else + echo "rye is already installed." + # Ensure rye's env is sourced if it's already installed but not in PATH + if ! command -v rye &> /dev/null + then + source "$HOME/.rye/env" + fi +fi + +# rye setup will manage python version and dependencies +rye sync \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8d286dd --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,26 @@ +[project] +name = "inspector" +version = "0.1.0" +description = "System inspection routine." +authors = [ + { name = "Sean Wilbur", email = "sean@abutili.com" } +] +dependencies = [ + "ansible>2.19", +] +readme = "README.md" +requires-python = ">= 3.12" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.rye] +managed = true +dev-dependencies = [] + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build.targets.wheel] +packages = ["src/inspector"] diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..75ef24e --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,32 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +ansible==12.0.0 + # via inspector +ansible-core==2.19.2 + # via ansible +cffi==2.0.0 + # via cryptography +cryptography==45.0.7 + # via ansible-core +jinja2==3.1.6 + # via ansible-core +markupsafe==3.0.2 + # via jinja2 +packaging==25.0 + # via ansible-core +pycparser==2.23 + # via cffi +pyyaml==6.0.2 + # via ansible-core +resolvelib==1.2.0 + # via ansible-core diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..75ef24e --- /dev/null +++ b/requirements.lock @@ -0,0 +1,32 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false +# generate-hashes: false +# universal: false + +-e file:. +ansible==12.0.0 + # via inspector +ansible-core==2.19.2 + # via ansible +cffi==2.0.0 + # via cryptography +cryptography==45.0.7 + # via ansible-core +jinja2==3.1.6 + # via ansible-core +markupsafe==3.0.2 + # via jinja2 +packaging==25.0 + # via ansible-core +pycparser==2.23 + # via cffi +pyyaml==6.0.2 + # via ansible-core +resolvelib==1.2.0 + # via ansible-core