pub struct InventoryData {
pub groups: HashMap<String, InventoryGroup>,
pub meta: Option<InventoryMeta>,
}Expand description
Structured representation of Ansible inventory data.
This struct represents the complete inventory data structure as returned
by ansible-inventory --list in JSON format. It includes all groups,
hosts, and metadata.
§Examples
use ansible::AnsibleInventory;
let mut inventory = AnsibleInventory::new();
inventory.set_inventory_file("hosts.yml");
let data = inventory.parse_inventory_data()?;
// Get all groups
let groups = data.groups();
println!("Groups: {:?}", groups);
// Get all hosts
let hosts = data.hosts();
println!("Hosts: {:?}", hosts);
// Get hosts in a specific group
let web_hosts = data.hosts_in_group("webservers");
println!("Web servers: {:?}", web_hosts);Fields§
§groups: HashMap<String, InventoryGroup>All inventory groups indexed by group name
meta: Option<InventoryMeta>Inventory metadata including host variables
Implementations§
Trait Implementations§
Source§impl Clone for InventoryData
impl Clone for InventoryData
Source§fn clone(&self) -> InventoryData
fn clone(&self) -> InventoryData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InventoryData
impl Debug for InventoryData
Source§impl<'de> Deserialize<'de> for InventoryData
impl<'de> Deserialize<'de> for InventoryData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for InventoryData
impl RefUnwindSafe for InventoryData
impl Send for InventoryData
impl Sync for InventoryData
impl Unpin for InventoryData
impl UnwindSafe for InventoryData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more