Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

Ansible Commonly Used Modules

Ansible has many built in modules, but some are used a lot more than others. In this lab we're going to reinforce the usage of some of the more common ones, so that they're easier for you to remember when the time comes. *This course is not approved or sponsored by Red Hat.*

Google Cloud Platform icon

Path Info

Clock icon Intermediate
Clock icon 45m
Clock icon Oct 18, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Verify Connectivity in the Environment

    On the command line run ansible -m ping all.

  2. Challenge

    Install httpd

    Your playbook, webservers.yml should look something like this:

    # Common Modules Playbook
    - name: Common Modules Playbook
      become: yes
      hosts: webservers
       - name: Install httpd on webservers
          name: httpd
          state: present
  3. Challenge

    Start and Enable the httpd Service

    In this task all we have to do is add the following to the webservers.yml playbook:

       - name: Start the httpd service
          name: httpd
          state: started
          enabled: yes
  4. Challenge

    Create a dba User Account

    Your playbook, dbserver.yml, should look similar to this:

    - name: DB server playbook
      become: yes
      hosts: dbservers
       - name: Add the 'dba' user to the dbservers
           name: dba
  5. Challenge

    Copy the Required File

    You can add to your dbserver.yml playbook something similar to the following:

       - name: Copy required DBA files
          src: /root/DBAstuff.txt
          dest: /home/dba/
          owner: dba
          group: dba
          mode: 0600
  6. Challenge

    Create /var/www/html/index.html

    The final addition to your webserver.yml playbook should look similar to:

       - name: Create index.html
          path: /var/www/html/index.html
          state: touch
  7. Challenge

    Clone the Ansible Git Repository into /opt on adminservers

    Your admin.yml playbook will look something like this:

    - name: Use git to clone the Ansible repo
      hosts: admins
      become: yes
       - name: Install git
          name: git
          state: present
       - name: Use the git module
          dest: /opt

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans