ansible

Crates.ioansible
lib.rsansible
version
sourcesrc
created_at2025-05-07 21:41:40.73592+00
updated_at2025-05-08 12:52:00.773373+00
descriptionRust API for Ansible
homepage
repositoryhttps://github.com/Lxkota95/ansible
max_upload_size
id1664579
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Jack Coleman (Lxkota95)

documentation

README

ansible

Rust API for Ansible

Progress Tracker

  • Ansible inventory command
  • Load trait for inventory to json
  • API to get hosts from inventory
  • API to get vars for host
  • Add Ansible test data to repo for use in test suite
  • Official Rust docs
  • Ansible adhoc command
  • Ansible playbook command

Features

  • Load Ansible inventory data into serde json object
use ansible::{Inventory, Load};

let inventory = Inventory::load(PathBuf::from('/path/to/inventory'))?;
let data = inventory.data
  • Get specific host from Ansible inventory
use ansible::{Inventory, Load};

let inventory = Inventory::load(PathBuf::from('/path/to/inventory'))?;
let host = inventory.get_host("<hostname>")?;
hostvars = host.get_vars()?;
  • Get all hosts from Ansible inventory
use ansible::{Inventory, Load};

let inventory = Inventory::load(PathBuf::from('/path/to/inventory'))?;
let hosts = inventory.get_hosts()?;
for host in hosts {
    hostvars = host.get_vars()?;
}

Tests

  • Execute tests with cargo test -- --nocapture to see stdout
Commit count: 0

cargo fmt