theforeman / theforeman.foreman / 4.0.0 / module / discovery_rule Manage Host Discovery Rules | "added in version" 3.5.0 of theforeman.foreman" Authors: Jeffrey van Pelt (@Thulium-Drake)theforeman.foreman.discovery_rule (4.0.0) — module
Install with ansible-galaxy collection install theforeman.foreman:==4.0.0
collections: - name: theforeman.foreman version: 4.0.0
Manage Host Discovery Rules
- name: 'Ensure Discovery Rule' theforeman.foreman.discovery_rule: username: 'admin' password: 'secret_password' server_url: 'https://foreman.example.com' name: 'my-first-disco' search: 'mac = bb:bb:bb:bb:bb:bb' hostgroup: 'RedHat7-Base' hostname: 'servera' max_count: 1 organizations: - 'MyOrg' locations: - 'DC1'
- name: 'Remove Discovery Rule' theforeman.foreman.discovery_rule: username: 'admin' password: 'secret_password' server_url: 'https://foreman.example.com' name: 'my-first-disco' state: 'absent'
name: description: - Name of the Discovery Rule required: true type: str state: choices: - present - absent default: present description: - State of the entity type: str search: description: - Expression to match newly discovered hosts with - Required if I(state=present) type: str enabled: description: - Enable or disable the rule type: bool hostname: description: - Hostname to assign to discovered host(s) - When matching multiple hosts, must provide unique hostnames for each of the discovered hosts type: str password: description: - Password of the user accessing the Foreman server. - If the value is not specified in the task, the value of environment variable C(FOREMAN_PASSWORD) will be used instead. required: true type: str priority: description: - Priority of the rule type: int username: description: - Username accessing the Foreman server. - If the value is not specified in the task, the value of environment variable C(FOREMAN_USERNAME) will be used instead. required: true type: str hostgroup: description: - Hostgroup to assign hosts to - Required if I(state=present) type: str locations: description: List of locations the entity should be assigned to elements: str type: list max_count: description: - Maximum amount of hosts to provision with the rule - 0 means no limit type: int server_url: description: - URL of the Foreman server. - If the value is not specified in the task, the value of environment variable C(FOREMAN_SERVER_URL) will be used instead. required: true type: str organizations: description: List of organizations the entity should be assigned to elements: str type: list validate_certs: default: true description: - Whether or not to verify the TLS certificates of the Foreman server. - If the value is not specified in the task, the value of environment variable C(FOREMAN_VALIDATE_CERTS) will be used instead. type: bool
entity: contains: discovery_rules: description: List of discovery rules. elements: dict type: list description: Final state of the affected entities grouped by their type. returned: success type: dict