id = "ansible" name = "Ansible" homepage = "https://docs.ansible.com/ansible/latest/reference_appendices/config.html" description = "Ansible is a radically simple IT automation system." icon = "SimpleIcons:ansible" # One config serves the whole command family, so every binary maps here. executables = [ "ansible", "ansible-playbook", "ansible-galaxy", "ansible-doc", "ansible-config", "ansible-lint", ] [dotfiles] # The config reference gives the search order as ANSIBLE_CONFIG, ansible.cfg # in the current directory, ~/.ansible.cfg in the home directory, then # /etc/ansible/ansible.cfg. Only the third is user-level. paths = ["~/.ansible.cfg"] # Everything under ANSIBLE_HOME (~/.ansible) that the same page documents as # working state: connection multiplexing sockets, temp files and the Galaxy # response cache. Roles and collections are downloaded artifacts. exclude = [ "~/.ansible/cp/", "~/.ansible/pc/", "~/.ansible/tmp/", "~/.ansible/galaxy_cache/", "~/.ansible/roles/", "~/.ansible/collections/", ] # GALAXY_TOKEN_PATH defaults to {{ ANSIBLE_HOME ~ "/galaxy_token" }} and holds # nothing but the Galaxy API token. secret = ["~/.ansible/galaxy_token"] # Re-read on every ansible run. side_effect = false # Every one of these is an absolute path to something that exists on this # control node: the inventory, the local role/collection trees, the SSH key # and vault password file used from here, and the log file. Every one is also # something the user chose and would have to put back to make this control # node work again, so they are kept: backup. [[dotfiles.machine_lines]] file = "~/.ansible.cfg" match = { prefix = [ "inventory", "roles_path", "collections_path", "private_key_file", "vault_password_file", "log_path", ] } scope = "backup" [commands] format = 1 label = "Run ad-hoc task" description = "Run a single module against a set of hosts with the ansible command. Playbooks (ansible-playbook), galaxy, vault handling and SSH argument passthrough are left out." quality = "ai-draft" base = "fig:ansible" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/ansible.ts" license = "MIT" [[commands.field]] id = "pattern" label = "Host pattern" description = "Inventory host, group or pattern, for example all or webservers." type = "string" position = 0 sources = ["fig"] [[commands.field]] id = "inventory" label = "Inventory" description = "Inventory file or a comma-separated host list." type = "string" option = ["--inventory", "-i"] sources = ["fig"] [[commands.field]] id = "module_name" label = "Module" type = "string" option = ["--module-name", "-m"] suggestions = [{ value = "ping", label = "ping" }, { value = "command", label = "command" }, { value = "shell", label = "shell" }, { value = "copy", label = "copy" }, { value = "setup", label = "setup (gather facts)" }] sources = ["fig"] [[commands.field]] id = "args" label = "Module arguments" type = "string" option = ["--args", "-a"] sources = ["fig"] [[commands.field]] id = "limit" label = "Limit to hosts" type = "string" option = ["--limit", "-l"] sources = ["fig"] [[commands.field]] id = "user" label = "Connect as user" type = "string" option = ["--user", "-u"] sources = ["fig"] [[commands.field]] id = "private_key" label = "Private key file" type = "path" option = ["--private-key", "--key-file"] path = { kind = "file", role = "input", must_exist = true } sources = ["fig"] [[commands.field]] id = "become" label = "Become (privilege escalation)" type = "boolean" option = ["--become", "-b"] effect = "exec" sources = ["fig"] [[commands.field]] id = "ask_become_pass" label = "Ask for become password" type = "boolean" option = ["--ask-become-pass", "-K"] sources = ["fig"] [[commands.field]] id = "ask_pass" label = "Ask for connection password" type = "boolean" option = ["--ask-pass", "-k"] sources = ["fig"] [[commands.field]] id = "extra_vars" label = "Extra variables" description = "key=value pairs, YAML/JSON, or @file." type = "string" option = ["--extra-vars", "-e"] multiple = true sources = ["fig"] [[commands.field]] id = "forks" label = "Parallel forks" type = "integer" option = ["--forks", "-f"] sources = ["fig"] [[commands.field]] id = "check" label = "Check mode (no changes)" type = "boolean" option = ["--check", "-C"] sources = ["fig"] [[commands.field]] id = "diff" label = "Show diffs" type = "boolean" option = ["--diff", "-D"] sources = ["fig"] [[commands.field]] id = "list_hosts" label = "List matching hosts only" type = "boolean" option = ["--list-hosts"] sources = ["fig"] [[commands.field]] id = "one_line" label = "Condensed output" type = "boolean" option = ["--one-line", "-o"] sources = ["fig"] [[commands.task]] id = "ping" label = "Ping hosts" set = { module_name = ["ping"] } lock = ["module_name"] fields = ["pattern", "module_name", "inventory", "limit", "user", "private_key", "ask_pass"] required = ["pattern"] [[commands.task]] id = "run-command" label = "Run a command on hosts" set = { module_name = ["command"] } fields = ["pattern", "module_name", "args", "inventory", "limit", "user", "private_key", "become", "ask_become_pass", "ask_pass", "check"] required = ["pattern", "args"] [[commands.task]] id = "list-hosts" label = "List matching hosts" set = { list_hosts = [true] } lock = ["list_hosts"] fields = ["pattern", "list_hosts", "inventory", "limit"] required = ["pattern"] [[commands.group]] id = "basic" label = "Basic" fields = ["pattern", "inventory", "module_name", "args", "limit", "user", "private_key", "become", "ask_become_pass", "ask_pass"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["extra_vars", "forks", "check", "diff", "list_hosts", "one_line"]