Ansible Ping Test

From bib. source

$ ansible -i hosts.ini example -m ping -u [username]

Note

A generalized version with environment variables would be: $ ansible -i $INVENTORY_FILEPATH $INVENTORY_FILE_SECTION_NAME -m ping -u $SSH_SERVER_USERNAME

If the command works (Geerling 2023, 7):

From bib. source

[…] you should see a message that shows www.example.com | SUCCESS >>, then the result of your ping. If it didn’t work, run the command again with -vvvv on the end to see verbose output.

Ansible bash_script bash_scripting command_line bash configuration_management environment_variable environment_variables variable verbose_output Bourne_Again_Shell Bourne_Again_Shell_script Bourne_Again_Shell_scripting ad-hoc_command ad-hoc_commands


bibliography

  • “Getting Started with Ansible.” In Ansible for DevOps: Server and Configuration Management for Humans, 2nd ed., 1–8. Leanpub, 2023.