Inventaire Ansible dynamique avec PostgreSQL
Project description
Ansibase
Inventaire Ansible dynamique avec PostgreSQL.
Installation
# -- Core uniquement
pip install ansibase
# -- Avec le plugin et script Ansible
pip install ansibase[ansible]
En utilisant le code source
# -- Core uniquement
pip install -e packages/ansibase
# -- Avec le plugin et script Ansible
pip install -e "packages/ansibase[ansible]"
Utilisation
En tant que bibliothèque Python
from ansibase import Database, DatabaseConfig, PgCrypto, InventoryBuilder
config = DatabaseConfig(host="localhost", port=5432, database="ansibase", user="ansibase", password="ansibase")
db = Database(config)
crypto = PgCrypto("ma_cle_de_chiffrement")
session = db.get_session()
builder = InventoryBuilder(session, crypto)
inventory = builder.build()
Script d'inventaire dynamique
# Lister l'inventaire complet
ansibase-inventory --list --config ansibase.ini
# Variables d'un hôte
ansibase-inventory --host monserveur --config ansibase.ini
Plugin Ansible
Ajouter dans ansible.cfg :
[defaults]
inventory_plugins = <chemin_vers_site-packages>/ansibase/ansible
[inventory]
enable_plugins = ansibase-ansible, auto
<chemin_vers_site-packages> peut etre obtenu en utilisant la commande
python -c "from pathlib import Path; import ansibase.ansible; print(Path(ansibase.ansible.__file__).parent.parent.parent)"
Puis utiliser avec un fichier ansibase.yml :
plugin: ansibase-ansible
host: localhost
port: 5432
database: ansibase
user: ansibase
password: "mon_mot_de_passe"
encryption_key: "ma_cle"
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
ansibase-1.0.0.tar.gz
(16.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ansibase-1.0.0-py3-none-any.whl
(20.8 kB
view details)
File details
Details for the file ansibase-1.0.0.tar.gz.
File metadata
- Download URL: ansibase-1.0.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b9a624ae23afe863ec412e841f16d790de711edb55adb751ae91ada7e4226e3
|
|
| MD5 |
7edad20b9de1a30e603251ba7aee39e9
|
|
| BLAKE2b-256 |
89fac8bf4e0ced1dd13648975d45e3f230288c0cd5a0e9535b2365e01feeda95
|
File details
Details for the file ansibase-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ansibase-1.0.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0fbea56ea4638788057310331be6899ec0946527a54e0f7106946aaa85c6389
|
|
| MD5 |
21ec3689614045a1a98d8f33cf81fe63
|
|
| BLAKE2b-256 |
031be49ae402c854fc0e44ef033d10ab03a5f23db508d78a73d3c30b43d3e6e8
|