ansible / ansible.builtin / v2.5.6 / module / bigip_command Run arbitrary command on F5 devices | "added in version" 2.4 of ansible.builtin" Authors: Tim Rupp (@caphrim007) preview | supported by communityansible.builtin.bigip_command (v2.5.6) — module
pip
Install with pip install ansible==2.5.6
Sends an arbitrary command to an BIG-IP node and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met.
- name: run show version on remote devices bigip_command: commands: show sys version server: lb.mydomain.com password: secret user: admin validate_certs: no delegate_to: localhost
- name: run show version and check to see if output contains BIG-IP bigip_command: commands: show sys version wait_for: result[0] contains BIG-IP server: lb.mydomain.com password: secret user: admin validate_certs: no delegate_to: localhost
- name: run multiple commands on remote nodes bigip_command: commands: - show sys version - list ltm virtual server: lb.mydomain.com password: secret user: admin validate_certs: no delegate_to: localhost
- name: run multiple commands and evaluate the output bigip_command: commands: - show sys version - list ltm virtual wait_for: - result[0] contains BIG-IP - result[1] contains my-vs server: lb.mydomain.com password: secret user: admin validate_certs: no delegate_to: localhost
- name: tmsh prefixes will automatically be handled bigip_command: commands: - show sys version - tmsh list ltm virtual server: lb.mydomain.com password: secret user: admin validate_certs: no delegate_to: localhost
match: default: all description: - The I(match) argument is used in conjunction with the I(wait_for) argument to specify the match policy. Valid values are C(all) or C(any). If the value is set to C(all) then all conditionals in the I(wait_for) must be satisfied. If the value is set to C(any) then only one of the values must be satisfied. retries: default: 10 description: - Specifies the number of retries a command should by tried before it is considered failed. The command is run on the target device every retry and evaluated against the I(wait_for) conditionals. commands: description: - The commands to send to the remote BIG-IP device over the configured provider. The resulting output from the command is returned. If the I(wait_for) argument is provided, the module is not returned until the condition is satisfied or the number of retries as expired. - The I(commands) argument also accepts an alternative form that allows for complex values that specify the command to run and the output format to return. This can be done on a command by command basis. The complex argument supports the keywords C(command) and C(output) where C(command) is the command to run and C(output) is 'text' or 'one-line'. required: true interval: default: 1 description: - Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditional, the interval indicates how to long to wait before trying the command again. provider: description: - A dict object containing connection details. suboptions: auth_provider: description: - Configures the auth provider for to obtain authentication tokens from the remote device. - This option is really used when working with BIG-IQ devices. type: str no_f5_teem: default: false description: - If C(yes), TEEM telemetry data is not sent to F5. - You may omit this option by setting the environment variable C(F5_TELEMETRY_OFF). - Previously used variable C(F5_TEEM) is deprecated as its name was confusing. type: bool password: aliases: - pass - pwd description: - The password for the user account used to connect to the BIG-IP or the BIG-IQ. - You may omit this option by setting the environment variable C(F5_PASSWORD). required: true type: str server: description: - The BIG-IP host or the BIG-IQ host. - You may omit this option by setting the environment variable C(F5_SERVER). required: true type: str server_port: default: 443 description: - The BIG-IP server port. - You may omit this option by setting the environment variable C(F5_SERVER_PORT). type: int timeout: description: - Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. type: int transport: choices: - rest default: rest description: - Configures the transport connection to use when connecting to the remote device. type: str user: description: - The username to connect to the BIG-IP or the BIG-IQ. This user must have administrative privileges on the device. - You may omit this option by setting the environment variable C(F5_USER). required: true type: str validate_certs: default: true description: - If C(no), SSL certificates are not validated. Use this only on personally controlled sites using self-signed certificates. - You may omit this option by setting the environment variable C(F5_VALIDATE_CERTS). type: bool type: dict version_added: 1.0.0 version_added_collection: f5networks.f5_modules wait_for: aliases: - waitfor description: - Specifies what to evaluate from the output of the command and what conditionals to apply. This argument will cause the task to wait for a particular conditional to be true before moving forward. If the conditional is not true by the configured retries, the task fails. See examples. transport: choices: - rest - cli default: rest description: - Configures the transport connection to use when connecting to the remote device. The transport argument supports connectivity to the device over cli (ssh) or rest. required: true version_added: '2.5' version_added_collection: ansible.builtin
failed_conditions: description: The list of conditionals that have failed returned: failed sample: - '...' - '...' type: list stdout: description: The set of responses from the commands returned: always sample: - '...' - '...' type: list stdout_lines: description: The value of stdout split into a list returned: always sample: - - '...' - '...' - - '...' - - '...' type: list