37 lines
2.2 KiB
Plaintext
37 lines
2.2 KiB
Plaintext
#compdef inventory-collector
|
|
|
|
_inventory_collector() {
|
|
local -a formats
|
|
formats=(
|
|
'ansible-yaml:Standard Ansible YAML inventory format'
|
|
'ansible-json:Ansible dynamic inventory JSON with _meta.hostvars'
|
|
'linux-connector:YAML schema formatted for linux-connector'
|
|
'yaml:Clean generic YAML dictionary'
|
|
'xml:Standard pretty-printed XML inventory'
|
|
'ini:Ansible INI inventory format'
|
|
)
|
|
|
|
_arguments \
|
|
'(-o --output)'{-o,--output}'[Target output file path]:file:_files' \
|
|
'(-f --format)'{-f,--format}'[Export format]:format:(ansible-yaml ansible-json linux-connector yaml xml ini)' \
|
|
'*-s[Path to static inventory file (.ini or .yaml)]:file:_files' \
|
|
'*--source[Path to static inventory file (.ini or .yaml)]:file:_files' \
|
|
'(--check --dry-run)'{--check,--dry-run}'[Inspect inventory without writing any files]' \
|
|
'--list[Ansible dynamic inventory mode: outputs JSON to stdout]' \
|
|
'--sync[Synchronize inventory to both Ansible and linux-connector default paths]' \
|
|
'(-q --quiet)'{-q,--quiet}'[Silence all informational and warning messages on stderr]' \
|
|
'(-v --verbose)'{-v,--verbose}'[Enable verbose output]' \
|
|
'(-c --config)'{-c,--config}'[Path to configuration file]:file:_files' \
|
|
'(-t --tag --filter-tag)'{-t,--tag,--filter-tag}'[Filter hosts by tag]:tag:' \
|
|
'(-g --group --category --filter-group)'{-g,--group,--category,--filter-group}'[Filter hosts by group or category]:group:' \
|
|
'(--source-type --filter-source --origin)'{--source-type,--filter-source,--origin}'[Filter hosts by source provider]:source:(proxmox static file plik k3s)' \
|
|
'(--sort --sort-by)'{--sort,--sort-by}'[Sort hosts by name or ip]:sort:(name ip)' \
|
|
'(-r --reverse)'{-r,--reverse}'[Reverse sort order]' \
|
|
'--ansible-dest[Destination path for Ansible inventory in --sync mode]:file:_files' \
|
|
'--lc-dest[Destination path for linux-connector inventory in --sync mode]:file:_files' \
|
|
'(-V --version)'{-V,--version}'[Show program version and exit]' \
|
|
'(-h --help)'{-h,--help}'[Show help message and exit]'
|
|
}
|
|
|
|
_inventory_collector "$@"
|