1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
//! # Ansible-rs
//!
//! A modern, type-safe Rust wrapper library for Ansible command-line tools.
//!
//! This library provides a safe, ergonomic interface for executing Ansible commands,
//! playbooks, and managing Ansible configurations from Rust applications. It supports
//! all major Ansible tools including `ansible`, `ansible-playbook`, `ansible-vault`,
//! `ansible-config`, and `ansible-inventory`.
//!
//! ## Features
//!
//! - **π Type-safe** - Leverages Rust's type system to prevent common configuration errors
//! - **π Modern API** - Uses builder patterns and fluent interfaces for ergonomic usage
//! - **π‘οΈ Comprehensive error handling** - Detailed error types for different failure modes
//! - **β‘ Memory efficient** - Optimized for minimal allocations and clones
//! - **π§ Smart build system** - Automatic Ansible detection and installation during build
//! - **π Cross-platform** - Supports Linux, macOS, and BSD systems
//! - **π Rust 2024 edition** - Uses the latest Rust features and idioms
//! - **π§ͺ 100% test coverage** - Comprehensive test suite with property-based testing
//!
//! ## System Requirements
//!
//! - **Supported platforms**: Linux, macOS, FreeBSD, OpenBSD, NetBSD
//! - **Ansible**: Version 2.9 or higher (automatically detected and installed)
//! - **Python**: Version 3.6 or higher (required by Ansible)
//!
//! The build script will automatically detect and attempt to install Ansible if not present.
//! See the [installation guide](https://docs.ansible.com/ansible/latest/installation_guide/) for manual installation.
//!
//! ## Quick Start
//!
//! ### Basic Ansible Commands
//!
//! ```rust,no_run
//! use ansible::{Ansible, Module};
//!
//! let mut ansible = Ansible::default();
//! ansible
//! .set_system_envs()
//! .filter_envs(["HOME", "PATH"])
//! .add_host("all")
//! .set_inventory("./hosts");
//!
//! // Execute a ping
//! let result = ansible.ping()?;
//! println!("Ping result: {}", result);
//!
//! // Execute a shell command
//! let result = ansible.shell("uptime")?;
//! println!("Uptime: {}", result);
//! # Ok::<(), ansible::AnsibleError>(())
//! ```
//!
//! ### Playbook Execution
//!
//! ```rust,no_run
//! use ansible::{Playbook, Play};
//!
//! let mut playbook = Playbook::default();
//! playbook.set_inventory("./hosts");
//!
//! // Run from file
//! let result = playbook.run(Play::from_file("site.yml"))?;
//! println!("Playbook result: {}", result);
//!
//! // Run from string content
//! let yaml_content = r#"
//! ---
//! - hosts: all
//! tasks:
//! - name: Ensure nginx is installed
//! package:
//! name: nginx
//! state: present
//! "#;
//! let result = playbook.run(Play::from_content(yaml_content))?;
//! # Ok::<(), ansible::AnsibleError>(())
//! ```
//!
//! ### Ansible Vault Operations
//!
//! Manage encrypted files and strings with Ansible Vault:
//!
//! ```rust,no_run
//! use ansible::AnsibleVault;
//!
//! let mut vault = AnsibleVault::new();
//! vault.set_vault_password_file("vault_pass.txt");
//!
//! // Encrypt a file
//! vault.encrypt("secrets.yml")?;
//!
//! // Decrypt a file
//! vault.decrypt("secrets.yml")?;
//!
//! // Encrypt a string
//! let encrypted = vault.encrypt_string("my_secret_password")?;
//! println!("Encrypted: {}", encrypted);
//! # Ok::<(), ansible::AnsibleError>(())
//! ```
//!
//! ### Configuration Management
//!
//! Query and manage Ansible configuration:
//!
//! ```rust,no_run
//! use ansible::{AnsibleConfig, ConfigFormat, PluginType};
//!
//! let mut config = AnsibleConfig::new();
//!
//! // List all configuration options
//! let config_list = config.list()?;
//! println!("Configuration: {}", config_list);
//!
//! // Dump configuration in JSON format
//! config.set_format(ConfigFormat::Json);
//! let config_dump = config.dump()?;
//! println!("Config dump: {}", config_dump);
//!
//! // List specific plugin types
//! config.set_plugin_type(PluginType::Callback);
//! let callbacks = config.list()?;
//! # Ok::<(), ansible::AnsibleError>(())
//! ```
//!
//! ### Inventory Management
//!
//! Parse and query Ansible inventories:
//!
//! ```rust,no_run
//! use ansible::{AnsibleInventory, InventoryFormat};
//!
//! let mut inventory = AnsibleInventory::new();
//! inventory
//! .set_inventory("hosts.yml")
//! .set_format(InventoryFormat::Json);
//!
//! // List all hosts
//! let hosts = inventory.list()?;
//! println!("Hosts: {}", hosts);
//!
//! // Get specific host information
//! let host_info = inventory.host("web01")?;
//! println!("Host info: {}", host_info);
//!
//! // Parse inventory data
//! let inventory_data = inventory.parse_inventory_data()?;
//! for (group_name, group) in &inventory_data.groups {
//! println!("Group {}: {} hosts", group_name, group.hosts.len());
//! }
//! # Ok::<(), ansible::AnsibleError>(())
//! ```
//!
//! ### System Requirements Validation
//!
//! Check system compatibility and Ansible installation:
//!
//! ```rust,no_run
//! use ansible::{validate_system, get_system_info, PlatformValidator};
//!
//! // Quick validation
//! validate_system()?;
//!
//! // Detailed system information
//! let system_info = get_system_info()?;
//! println!("{}", system_info);
//!
//! if system_info.is_fully_supported() {
//! println!("All Ansible features are available!");
//! } else {
//! println!("Missing features: {:?}", system_info.missing_features());
//! }
//!
//! // Check individual components
//! if PlatformValidator::is_platform_supported() {
//! println!("Platform is supported");
//! }
//! # Ok::<(), ansible::AnsibleError>(())
//! ```
//!
//! ## Error Handling
//!
//! The library provides comprehensive error handling with detailed error types:
//!
//! ```rust,no_run
//! use ansible::{Ansible, AnsibleError};
//!
//! let result = Ansible::default().ping();
//! match result {
//! Ok(output) => println!("Success: {}", output),
//! Err(AnsibleError::CommandFailed { message, exit_code, stdout, stderr }) => {
//! eprintln!("Command failed: {}", message);
//! if let Some(code) = exit_code {
//! eprintln!("Exit code: {}", code);
//! }
//! if let Some(stderr) = stderr {
//! eprintln!("Error: {}", stderr);
//! }
//! }
//! Err(AnsibleError::UnsupportedPlatform(msg)) => {
//! eprintln!("Platform not supported: {}", msg);
//! }
//! Err(e) => eprintln!("Other error: {}", e),
//! }
//! ```
//!
//! ## Environment Variables
//!
//! Control build-time behavior with environment variables:
//!
//! - `SKIP_ANSIBLE_CHECK=1` - Skip Ansible installation check during build
//! - `ANSIBLE_AUTO_INSTALL=true` - Enable automatic Ansible installation
//! - `CI=1` - Disable interactive installation prompts in CI environments
//! - `DOCS_RS=1` - Skip all checks when building documentation
//!
//! ## Module Organization
//!
//! The library is organized into several modules:
//!
//! - Core Ansible command execution and module management
//! - Ansible playbook execution and management
//! - [`vault`] - Ansible Vault encryption and decryption operations
//! - [`config`] - Ansible configuration querying and management
//! - [`inventory`] - Inventory parsing and host management
//! - [`platform`] - System requirements validation and platform detection
//! - [`errors`] - Comprehensive error types and handling
//! - [`command_config`] - Low-level command configuration utilities
//!
//! ## Examples
//!
//! See the `examples/` directory for complete working examples:
//!
//! - `examples/basic.rs` - Basic Ansible commands
//! - `examples/playbook.rs` - Playbook execution
//! - `examples/new_features_demo.rs` - Vault, config, and inventory features
//! - `examples/system_check.rs` - System requirements validation
//! - `examples/test_build.rs` - Build script functionality testing
// εΌζ₯ζ―ζ樑εοΌε―ιοΌ
// Re-export main types for convenience
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// εΌζ₯η±»ειζ°ε―ΌεΊοΌε―ιοΌ
pub use ;