Training #3 Asnible Ad-hoc practice

Overview:

Setup Vagrant 1 then three Vagrant VMs. Install Ansible on the host and one of Vagrant VM. The practice can either on the host system or the Vagrant VM that acting as Ansible management node.


Practice items:

Ansible PING module used in this practice. It can be any as user seems fit. Some steps may not even be Ansible related but included to be familiar with the tools available.

Repeated word used:

Ansible controller node: System with Ansible installed.

Ansible managed node: System can be reached by Ansible’s account.

  • – On the host:
    • -perform “PING” using ad-hoc, playbook and vagrant provision. 
  • – On the Ansible controller node:
    • -Use Ansible ad-hoc and playbook to manage (e.g. ping) all Linux systems in the inventory.
    • -Familiar with Ansible module to gather system facts and its stdout.
    • -Familiar with creating Ansible role and how to call it.
    • -Familiar with generating ansible.cfg example file. Review the examples and familiarize self with default configurations.
      • -With the new ansible.cfg, perform Ansible ad-hoc to create a user, view its account info then delete it once done.
    • -Install httpd on one of Ansible managed node.
    • -Verify installed httpd with “command” and “shell” modules. Understand the difference between the two. Hint: run a command with pipe (‘|’) and see the difference.
    • -Use an Ansible module to enable httpd service, then check its status. hint#1
    • -Create a Bash script to run Ansible command (e.g package install, enable the service, then check the service).

Practice items with some samples:

  • – ansible <localhost, ungrouped or all> -m ping
  • – ansible <localhost, ungrouped or all> -m user -a “name=testuser”
  • – hint#1: check service related Ansible doc.
References:
  1. Install | Vagrant | HashiCorp Developer ↩︎