From 6944b0b2ad1dc17d8ec7deaff248f8a769eeb02c Mon Sep 17 00:00:00 2001 From: c0de Date: Wed, 3 Jan 2024 23:16:05 -0600 Subject: [PATCH] Initial Commit --- .editorconfig | 18 ++++++++++++ .gitignore | 1 + .vscode/settings.json | 5 ++++ LICENSE.txt | 28 +++++++++++++++++++ ansible/inventories/group_vars/pibox.yml | 1 + .../host_vars/pibox-01.c0de.online.yml | 1 + .../host_vars/pibox-02.c0de.online.yml | 1 + ansible/inventories/inventory.yml | 6 ++++ readme.md | 20 +++++++++++++ requirements.txt | 10 +++++++ 10 files changed, 91 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 LICENSE.txt create mode 100644 ansible/inventories/group_vars/pibox.yml create mode 100644 ansible/inventories/host_vars/pibox-01.c0de.online.yml create mode 100644 ansible/inventories/host_vars/pibox-02.c0de.online.yml create mode 100644 ansible/inventories/inventory.yml create mode 100644 readme.md create mode 100644 requirements.txt diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..54e5741 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,18 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a85cef1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/*venv diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ef8a925 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.words": [ + "pibox" + ] +} diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..f56657e --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2024, Code Fox + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ansible/inventories/group_vars/pibox.yml b/ansible/inventories/group_vars/pibox.yml new file mode 100644 index 0000000..326242f --- /dev/null +++ b/ansible/inventories/group_vars/pibox.yml @@ -0,0 +1 @@ +# Group Vars for pibox devices diff --git a/ansible/inventories/host_vars/pibox-01.c0de.online.yml b/ansible/inventories/host_vars/pibox-01.c0de.online.yml new file mode 100644 index 0000000..333a8e0 --- /dev/null +++ b/ansible/inventories/host_vars/pibox-01.c0de.online.yml @@ -0,0 +1 @@ +# Host Vars for the first pibox host diff --git a/ansible/inventories/host_vars/pibox-02.c0de.online.yml b/ansible/inventories/host_vars/pibox-02.c0de.online.yml new file mode 100644 index 0000000..498a6df --- /dev/null +++ b/ansible/inventories/host_vars/pibox-02.c0de.online.yml @@ -0,0 +1 @@ +# Host Vars for the second pibox host diff --git a/ansible/inventories/inventory.yml b/ansible/inventories/inventory.yml new file mode 100644 index 0000000..c15f6fd --- /dev/null +++ b/ansible/inventories/inventory.yml @@ -0,0 +1,6 @@ +pibox: + hosts: + pibox-01.c0de.online + pibox-02.c0de.online + vars: + ansible_user: c0de diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..4b540b8 --- /dev/null +++ b/readme.md @@ -0,0 +1,20 @@ +# pibox-ansible + +Some ansible playbooks to manage a [pibox](https://pibox.io) in various ways + +## Prerequisites + +1. Internet connection +1. Python 3 on Linux (or WSL) +1. One or more PiBoxes that you don't want to manage through [KubeSail](https://kubesail.com) + +## Getting Started + +1. Clone this repository: `git clone https://c0de.dev/c0de/pibox-ansible` +1. Enter the repo: `cd pibox-ansible` +1. Create a python virtual environment: `python3 -m venv .venv` +1. Enter the virtual environment: `source .venv/bin/activate` +1. (optional) Upgrade PIP: `pip3 install --upgrade pip` +1. Install ansible: `pip3 install -r requirements.txt` +1. Configure Inventory, host vars and group vars + 1. You probably don't have my domain name on your network lol diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f2dc778 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +ansible==9.1.0 +ansible-core==2.16.2 +cffi==1.16.0 +cryptography==41.0.7 +Jinja2==3.1.2 +MarkupSafe==2.1.3 +packaging==23.2 +pycparser==2.21 +PyYAML==6.0.1 +resolvelib==1.0.1