Documentation
¶
Overview ¶
Package modules implements Ansible's module execution model: each module is a Go function that takes a target connection (github.com/go-remoteexec/transport) and a set of arguments (already Jinja2-rendered by the caller) and returns a Result — Ansible's changed/failed/msg triple plus any module-specific fields.
Unlike real Ansible, which copies a Python script to the target and runs it there, a module here runs its logic on the control node and reaches the target only through the Connection's Exec/Put/Fetch primitives. The observable behavior is the same (the target ends up in the same state); the difference is architectural, not behavioral, and it means a module needs no Go toolchain on the target.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Docs = map[string]string{}/* 398 elements not displayed */
Docs maps every registered module name to its Go doc comment — the same argument/deviation documentation this project has always written on each module<Name> function, extracted once at build time so ansible-doc can print it without the source tree present.
Functions ¶
This section is empty.
Types ¶
type Func ¶
type Func func(ctx context.Context, conn remoteexec.Connection, args map[string]any) (Result, error)
Func is a module's entry point. ctx carries cancellation/timeout; conn is already connected to the task's target; args is the task's parameters, already Jinja2-rendered by the caller (this package never templates anything itself). A non-nil error means the module could not determine an outcome at all (a transport failure); an expected failure is a Result with Failed=true and a nil error.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps module names to their Func.
func Default ¶
func Default() *Registry
Default returns a Registry pre-populated with this package's built-in module set.
func (*Registry) Register ¶
Register adds fn under name, replacing any existing module of the same name (so a caller can override a built-in with a custom module).
func (*Registry) Run ¶
func (r *Registry) Run(ctx context.Context, name string, conn remoteexec.Connection, args map[string]any) (Result, error)
Run looks up name and runs it, returning a Result{Failed:true} (not a Go error) for an unknown module name — matching Ansible's own "couldn't resolve module" being a task failure, not a crash.
type Result ¶
type Result struct {
Changed bool
Failed bool
Msg string
Facts map[string]any
Extra map[string]any
}
Result is a module's outcome: Ansible's changed/failed/msg triple, plus optional facts (merged into ansible_facts, e.g. by set_fact) and module-specific extra fields (e.g. command's stdout/stderr/rc).
func Fail ¶
Fail returns a failed result. Modules normally return this alongside a non-nil error only when the failure is unexpected (a connection error, an unreadable file); an expected, well-formed failure (e.g. the `fail` module itself, or `assert` on a false condition) returns it with a nil error, since it is not the module's own execution that went wrong.
Source Files
¶
- acl.go
- aix_devices.go
- aix_filesystem.go
- aix_inittab.go
- aix_lvg.go
- aix_lvol.go
- alternatives.go
- android_sdk.go
- apache2_mod_proxy.go
- apache2_module.go
- apk.go
- apt.go
- apt_key.go
- apt_repo.go
- apt_repository.go
- apt_rpm.go
- archive.go
- args.go
- assemble.go
- async_status.go
- at.go
- authorized_key.go
- awall.go
- beadm.go
- blockinfile.go
- bootc_manage.go
- btrfs_info.go
- btrfs_subvolume.go
- bundler.go
- bzr.go
- capabilities.go
- cargo.go
- cloud_init_data_facts.go
- cobbler_sync.go
- cobbler_system.go
- command.go
- composer.go
- consul.go
- consul_acl.go
- consul_acl_bootstrap.go
- consul_agent_check.go
- consul_agent_service.go
- consul_auth_method.go
- consul_binding_rule.go
- consul_kv.go
- consul_kv_info.go
- consul_policy.go
- consul_role.go
- consul_session.go
- consul_token.go
- copr.go
- copy.go
- cpanm.go
- cron.go
- cronvar.go
- crypttab.go
- dconf.go
- deb822_repository.go
- debconf.go
- debug.go
- decompress.go
- deploy_helper.go
- django_check.go
- django_command.go
- django_createcachetable.go
- django_dumpdata.go
- django_loaddata.go
- django_manage.go
- dnf.go
- dnf5.go
- dnf_config_manager.go
- dnf_versionlock.go
- docs_generated.go
- dpkg_divert.go
- dpkg_selections.go
- ejabberd_user.go
- elasticsearch_plugin.go
- etcd3.go
- exec.go
- expect.go
- facter_facts.go
- fetch.go
- file.go
- filesize.go
- filesystem.go
- find.go
- firewalld.go
- firewalld_info.go
- flatpak.go
- flatpak_remote.go
- gather_facts.go
- gconftool2.go
- gconftool2_info.go
- gem.go
- get_url.go
- getent.go
- gio_mime.go
- git.go
- git_config.go
- git_config_info.go
- github_common.go
- github_deploy_key.go
- github_issue.go
- github_key.go
- github_release.go
- github_repo.go
- github_secrets.go
- github_secrets_info.go
- github_webhook.go
- github_webhook_info.go
- gitlab_branch.go
- gitlab_common.go
- gitlab_dedicated_common.go
- gitlab_deploy_key.go
- gitlab_group.go
- gitlab_group_access_token.go
- gitlab_group_members.go
- gitlab_group_variable.go
- gitlab_hook.go
- gitlab_instance_variable.go
- gitlab_issue.go
- gitlab_label.go
- gitlab_merge_request.go
- gitlab_milestone.go
- gitlab_project.go
- gitlab_project_access_token.go
- gitlab_project_approvals.go
- gitlab_project_badge.go
- gitlab_project_members.go
- gitlab_project_variable.go
- gitlab_protected_branch.go
- gitlab_runner.go
- gitlab_user.go
- golang_package.go
- group.go
- gunicorn.go
- haproxy.go
- hg.go
- homebrew.go
- homebrew_cask.go
- homebrew_services.go
- homebrew_tap.go
- homectl.go
- hostname.go
- htpasswd.go
- icinga2_downtime.go
- icinga2_feature.go
- icinga2_host.go
- imgadm.go
- influxdb_database.go
- influxdb_query.go
- influxdb_retention_policy.go
- influxdb_user.go
- influxdb_write.go
- ini_file.go
- installp.go
- interfaces_file.go
- ip_netns.go
- ipa_common.go
- ipa_config.go
- ipa_dnsrecord.go
- ipa_dnszone.go
- ipa_getkeytab.go
- ipa_group.go
- ipa_hbacrule.go
- ipa_host.go
- ipa_hostgroup.go
- ipa_otpconfig.go
- ipa_otptoken.go
- ipa_pwpolicy.go
- ipa_role.go
- ipa_service.go
- ipa_subca.go
- ipa_sudocmd.go
- ipa_sudocmdgroup.go
- ipa_sudorule.go
- ipa_user.go
- ipa_vault.go
- ipmi_boot.go
- ipmi_power.go
- iptables.go
- iptables_state.go
- iso_create.go
- iso_customize.go
- iso_extract.go
- java_cert.go
- java_keystore.go
- jboss.go
- kdeconfig.go
- kernel_blacklist.go
- keyring.go
- keyring_info.go
- kibana_plugin.go
- known_hosts.go
- kopia_repository.go
- kopia_repository_info.go
- krb_ticket.go
- launchd.go
- layman.go
- lbu.go
- ldap_attrs.go
- ldap_common.go
- ldap_entry.go
- ldap_inc.go
- ldap_passwd.go
- ldap_search.go
- lineinfile.go
- listen_ports_facts.go
- lldp_facts.go
- locale_gen.go
- logrotate.go
- logstash_plugin.go
- lvg.go
- lvg_rename.go
- lvm_pv.go
- lvm_pv_move_data.go
- lvol.go
- lxc_container.go
- lxd_container.go
- lxd_profile.go
- lxd_project.go
- lxd_storage_pool_info.go
- lxd_storage_volume_info.go
- macports.go
- mail.go
- make.go
- mas.go
- maven_artifact.go
- mksysb.go
- modprobe.go
- module.go
- monit.go
- mount.go
- mount_facts.go
- mqtt.go
- mssql_db.go
- mssql_script.go
- nagios.go
- nginx_status_info.go
- nictagadm.go
- nmcli.go
- nomad_job.go
- nomad_job_info.go
- nomad_token.go
- nosh.go
- npm.go
- nsupdate.go
- odbc.go
- ohai.go
- omapi_host.go
- open_iscsi.go
- openbsd_pkg.go
- opendj_backendprop.go
- openwrt_init.go
- opkg.go
- osx_defaults.go
- pacemaker_cluster.go
- pacemaker_info.go
- pacemaker_resource.go
- package.go
- package_facts.go
- pacman.go
- pacman_key.go
- pam_limits.go
- pamd.go
- parted.go
- patch.go
- pause.go
- pear.go
- pids.go
- ping.go
- pip.go
- pip_package_info.go
- pipx.go
- pipx_info.go
- pkg5.go
- pkg5_publisher.go
- pkgin.go
- pkgmgr.go
- pkgng.go
- pkgutil.go
- pmem.go
- pnpm.go
- portage.go
- portinstall.go
- puppet.go
- python_requirements_info.go
- raw.go
- read_csv.go
- reboot.go
- redhat_subscription.go
- redis.go
- redis_data.go
- redis_data_incr.go
- redis_data_info.go
- redis_info.go
- registry.go
- replace.go
- rhel_facts.go
- rhel_rpm_ostree.go
- rhsm_release.go
- rhsm_repository.go
- riak.go
- rpm_key.go
- rpm_ostree_pkg.go
- rpm_ostree_upgrade.go
- runit.go
- say.go
- script.go
- seboolean.go
- sefcontext.go
- selinux.go
- selinux_permissive.go
- selogin.go
- seport.go
- serverless.go
- service_facts.go
- set_stats.go
- setfact.go
- setup.go
- shellquote.go
- shutdown.go
- simpleinit_msb.go
- slackpkg.go
- slurp.go
- smartos_image_info.go
- snap.go
- snap_alias.go
- snap_connect.go
- snmp_facts.go
- solaris_zone.go
- sorcery.go
- ssh_config.go
- sssd_info.go
- stat.go
- statsd.go
- subversion.go
- sudoers.go
- supervisorctl.go
- svc.go
- svr4pkg.go
- swdepot.go
- swupd.go
- synchronize.go
- sysctl.go
- syslogger.go
- syspatch.go
- sysrc.go
- systemd.go
- systemd_creds_decrypt.go
- systemd_creds_encrypt.go
- systemd_info.go
- sysupgrade.go
- sysvinit.go
- tempfile.go
- template.go
- terraform.go
- timezone.go
- udm_common.go
- udm_dns_record.go
- udm_dns_zone.go
- udm_group.go
- udm_share.go
- udm_user.go
- ufw.go
- unarchive.go
- uri.go
- urpmi.go
- usb_facts.go
- user.go
- uv_python.go
- validate_argument_spec.go
- vdo.go
- vertica.go
- vertica_configuration.go
- vertica_info.go
- vertica_role.go
- vertica_schema.go
- vertica_user.go
- vmadm.go
- wait_for.go
- wait_for_connection.go
- wakeonlan.go
- write_binary_file.go
- xattr.go
- xbps.go
- xdg_mime.go
- xenserver_common.go
- xenserver_facts.go
- xenserver_guest.go
- xenserver_guest_info.go
- xenserver_guest_powerstate.go
- xfconf.go
- xfconf_info.go
- xfs_quota.go
- xml.go
- xml_info.go
- yarn.go
- yum_repository.go
- yum_versionlock.go
- zfs.go
- zfs_delegate_admin.go
- zfs_facts.go
- znode.go
- zpool.go
- zpool_facts.go
- zypper.go
- zypper_repository.go
- zypper_repository_info.go
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
gendocs
command
Command gendocs extracts each registered module's Go doc comment (already written on its module<Name> function — this project's convention has always been to document arguments and every deviation from real Ansible's behavior there) and emits docs_generated.go: a map from the module's registered name to that comment text, for ansible-doc to print without needing the source tree at runtime.
|
Command gendocs extracts each registered module's Go doc comment (already written on its module<Name> function — this project's convention has always been to document arguments and every deviation from real Ansible's behavior there) and emits docs_generated.go: a map from the module's registered name to that comment text, for ansible-doc to print without needing the source tree at runtime. |