一键导入
ansible-controller-host
create, update, or destroy Automation Platform Controller host. Use when managing host resources on remote hosts via Ansible.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
create, update, or destroy Automation Platform Controller host. Use when managing host resources on remote hosts via Ansible.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
create, update, or destroy Automation Platform Controller credential. Use when managing credential resources on remote hosts via Ansible.
Create, update, or destroy custom Automation Platform Controller credential type. Use when managing credential type resources on remote hosts via Ansible.
create, update, or destroy Execution Environments in Automation Platform Controller. Use when managing execution environment resources on remote hosts via Ansible.
create, update, or destroy Automation Platform Controller group. Use when managing group resources on remote hosts via Ansible.
create, update, or destroy Automation Platform Controller inventory. Use when managing inventory resources on remote hosts via Ansible.
create, update, or destroy job templates. Use when managing job template resources on remote hosts via Ansible.
| name | ansible.controller.host |
| description | create, update, or destroy Automation Platform Controller host. Use when managing host resources on remote hosts via Ansible. |
create, update, or destroy Automation Platform Controller host.
Use the ansible.controller.host Ansible module when you need to manage host on remote hosts. This is preferable to local CLI commands when:
--checkDo not use this for basic local file operations or CLI tasks that the agent can handle natively.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
inventory | str | yes | - | Inventory name, ID, or named URL the host should be made a member of. |
name | str | yes | - | The name to use for the host. |
aap_token | raw | no | - | The OAuth token to use. This value can be in one of two formats. A string which is the token itself. (i.e. bqV5txm97wqJqtkxlMkhQz0pKhRMMX) A dictionary structure as returned by the token module. If value not set, will try environment variable C(CONTROLLER_OAUTH_TOKEN) and then config files |
controller_config_file | path | no | - | Path to the controller config file. If provided, the other locations for config files will not be considered. |
controller_host | str | no | - | URL to your Automation Platform Controller instance. If value not set, will try environment variable C(CONTROLLER_HOST) and then config files If value not specified by any means, the value of C(127.0.0.1) will be used |
controller_password | str | no | - | Password for your controller instance. If value not set, will try environment variable C(CONTROLLER_PASSWORD) and then config files |
controller_username | str | no | - | Username for your controller instance. If value not set, will try environment variable C(CONTROLLER_USERNAME) and then config files |
description | str | no | - | The description to use for the host. |
enabled | bool | no | - | If the host should be enabled. |
new_name | str | no | - | To use when changing a hosts's name. |
request_timeout | float | no | - | Specify the timeout Ansible should use in requests to the controller host. Defaults to 10s, but this is handled by the shared module_utils code |
state | str | no | present | Desired state of the resource. |
validate_certs | bool | no | - | Whether to allow insecure connections to AWX. If C(no), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If value not set, will try environment variable C(CONTROLLER_VERIFY_SSL) and then config files |
variables | dict | no | - | Variables to use for the host. |
Run this module using the ansible CLI (from ansible-core):
ansible <host-pattern> -m ansible.controller.host -a "<key=value arguments>" -b --check --diff
# Dry-run first (always recommended for destructive operations)
ansible webservers -m ansible.controller.host -a "inventory=Local Inventory name=localhost" -b --check --diff
# Apply the change
ansible webservers -m ansible.controller.host -a "inventory=Local Inventory name=localhost" -b --diff
- name: Add host
host:
name: localhost
description: "Local Host Group"
inventory: "Local Inventory"
state: present
controller_config_file: "~/tower_cli.cfg"
variables:
example_var: 123
| Flag | Purpose |
|---|---|
-b | Run with sudo/become (required for most system changes) |
--check | Dry-run mode -- shows what would change without applying |
--diff | Shows detailed before/after differences |
-i <path> | Specify inventory file (see Inventory section below) |
-l <pattern> | Limit to specific hosts within a group |
To get structured JSON output for programmatic parsing:
ANSIBLE_STDOUT_CALLBACK=json ansible <hosts> -m ansible.controller.host -a "<args>" -b
Or set stdout_callback = json in your ansible.cfg.
--check --diff before applying destructive changes-b. Check the parameters above for guidance.When using this module from a different location than the project root:
-i /path/to/inventory.ymlexport ANSIBLE_INVENTORY=/path/to/inventory.yml/etc/ansible/hostsansible <hostname>, -m ansible.controller.host -a "..." (note the trailing comma)