theforeman / theforeman.foreman / 0.8.1 / module / foreman_host_power Manage Foreman hosts power state Authors: Bernhard Hopfenmueller (@Fobhep) ATIX AG, Baptiste Agasse (@bagasse) preview | supported by communitytheforeman.foreman.foreman_host_power (0.8.1) — module
Install with ansible-galaxy collection install theforeman.foreman:==0.8.1
collections: - name: theforeman.foreman version: 0.8.1
Manage power state of Foreman host
This beta version can start and stop an existing foreman host and question the current power state.
- name: "Switch a host on" foreman_host_power: username: "admin" password: "changeme" server_url: "https://foreman.example.com" hostname: "test-host.domain.test" state: on
- name: "Switch a host off" foreman_host_power: username: "admin" password: "changeme" server_url: "https://foreman.example.com" hostname: "test-host.domain.test" state: off
- name: "Query host power state" foreman_host_power: username: "admin" password: "changeme" server_url: "https://foreman.example.com" hostname: "test-host.domain.test" state: state register: result
- debug: msg: "Host power state is {{ result.power_state }}"
name: aliases: - hostname description: Name (FQDN) of the host required: true type: str state: choices: - 'on' - start - 'off' - stop - soft - reboot - cycle - reset - state - status default: state description: Desired power state type: str password: description: Password of the user accessing the Foreman server required: true type: str username: description: Username accessing the Foreman server required: true type: str server_url: description: URL of the Foreman server required: true type: str validate_certs: aliases: - verify_ssl default: true description: Whether or not to verify the TLS certificates of the Foreman server type: bool
power_state: description: current power state of host returned: always sample: 'off' type: str