Initial Commit

This commit is contained in:
c0de 2024-01-21 12:58:06 -05:00
commit 732455607d
10 changed files with 101 additions and 0 deletions

16
.editorconfig Normal file
View File

@ -0,0 +1,16 @@
# 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
indent_size = 2

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
**/*venv*
**/*.log

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"license.filename": "license",
"license.extension": ".txt",
"license.author": "Code Fox <c0de@c0de.dev>",
"license.default": "bsd-3-clause"
}

28
license.txt Normal file
View File

@ -0,0 +1,28 @@
BSD 3-Clause License
Copyright (c) 2024, Code Fox <c0de@c0de.dev>
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.

0
logs/.gitkeep Normal file
View File

View File

14
playbooks/play.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
playbook_name=$1
inventory_path="./inventories/"
log_path="../logs"
log_file="${log_path}/${playbook_name}.log"
mkdir -p "${log_path}"
echo "${playbook_name} started at $(date)" | tee -a "${log_file}"
{ time ansible-playbook -i "${inventory_path}" "${playbook_name}" ; } 2>&1 | tee -a "${log_file}"
echo "${playbook_name} finished at $(date)" | tee -a "${log_file}"

0
playbooks/roles/.gitkeep Normal file
View File

25
readme.md Normal file
View File

@ -0,0 +1,25 @@
# proxmox-ansible
Ansible playbooks to manage proxmox in a variety of ways
## Requirements
1. Linux (or WSL) or Mac
1. Python 3
## Getting Started
1. Clone this repository: `git clone https://c0de.dev/c0de/proxmox-ansible`
1. Enter this repository: `cd proxmox-ansible`
1. Create a Python virtual environment: `python3 -m venv .venv`
1. Activate the virtual environment: `source .venv/bin/activate`
1. (Optional) Upgrade pip: `pip3 install --upgrade pip`
1. Install requirements: `pip3 install -r requirements.txt`
1. Install Ansible General Community Collection: `ansible-galaxy collection install community.general`
- _Note: This might already be installed._
## Running Playbooks
1. Enter the playbook directory: `cd playbooks`
1. Run `./play.sh <playbook-name>.yml`
- The script will record a log of the output, as well as timing information in [logs](./logs)

10
requirements.txt Normal file
View File

@ -0,0 +1,10 @@
ansible==9.1.0
ansible-core==2.16.2
cffi==1.16.0
cryptography==41.0.7
Jinja2==3.1.3
MarkupSafe==2.1.4
packaging==23.2
pycparser==2.21
PyYAML==6.0.1
resolvelib==1.0.1