Identify the workflow being automated by an Ansible playbook (management packages, user management related to services, basic service configuration, and start/stop)

📘Cisco DevNet Associate (200-901 DEVASC)


1. What is Ansible?

Ansible is an automation tool used to configure systems, deploy applications, and manage infrastructure.

It works by executing instructions written in playbooks.

Key Characteristics of Ansible

  • Agentless (no software needed on target devices)
  • Uses SSH for communication
  • Written in YAML
  • Uses reusable modules
  • Works with servers, network devices, and cloud infrastructure

In DevNet environments, Ansible helps automate network configuration, server configuration, and service management.


2. What is an Ansible Playbook?

An Ansible playbook is a file written in YAML format that contains a set of automation tasks.

A playbook defines:

  • Which systems to configure
  • What tasks should be executed
  • In what order the tasks run

Example Structure of a Playbook

---
- name: Configure Web Server
hosts: webservers
become: yes tasks:
- name: Install Apache
apt:
name: apache2
state: present

Main Components

ComponentDescription
HostsTarget systems where tasks will run
TasksIndividual automation steps
ModulesBuilt-in tools that perform actions
VariablesStore reusable values
HandlersTriggered actions after changes

A playbook typically represents a complete workflow for configuring a system.


3. Understanding Automation Workflow in Ansible

An automation workflow is a sequence of steps performed automatically.

A typical IT workflow might include:

  1. Install required packages
  2. Create or manage users
  3. Configure services
  4. Start or stop services

These steps are defined in an Ansible playbook and executed in order.

For the DEVASC exam, you should be able to identify these workflow steps in a playbook.


4. Workflow Step 1 — Managing Packages

Package management is one of the most common automation tasks.

Packages are software components installed on a system such as:

  • Web servers
  • Database software
  • Monitoring tools
  • Networking tools

Ansible automates package installation, removal, and updates.

Common Package Modules

ModuleSystem Type
aptDebian/Ubuntu systems
yumRedHat/CentOS
dnfFedora
packageGeneric package manager

Example: Installing a Package

- name: Install Nginx
apt:
name: nginx
state: present

What This Task Does

  1. Connects to the server
  2. Checks if nginx is installed
  3. Installs it if missing

This ensures the desired state of the system.


Example: Removing a Package

- name: Remove Apache
apt:
name: apache2
state: absent

This removes unwanted software automatically.


Why Package Management is Important

In IT environments:

  • Hundreds of servers require the same software
  • Manual installation takes time
  • Automation ensures consistent software versions

5. Workflow Step 2 — User Management Related to Services

Services often require specific users to run them securely.

Examples include:

  • Web service accounts
  • Database service users
  • Monitoring users

Ansible can automate user management.


User Management Tasks

Typical tasks include:

  • Creating users
  • Deleting users
  • Managing passwords
  • Assigning permissions
  • Adding users to groups

Example: Creating a User

- name: Create service user
user:
name: webadmin
state: present

What Happens

The playbook:

  1. Checks if the user exists
  2. Creates the user if not present

Example: Adding a User to a Group

- name: Add user to group
user:
name: webadmin
groups: www-data
append: yes

This allows the user to manage web services.


Why User Management is Automated

In large environments:

  • Systems must follow security policies
  • Service users must have correct permissions
  • Automation ensures consistent access control

6. Workflow Step 3 — Basic Service Configuration

After installing software, it must be configured.

Configuration defines:

  • Ports used by the service
  • File locations
  • Security settings
  • Service parameters

Ansible can automatically configure these settings.


Methods for Configuration

Ansible uses several modules:

ModulePurpose
copyCopy configuration files
templateCreate dynamic configuration files
lineinfileModify specific lines in files
blockinfileInsert blocks of configuration

Example: Copy Configuration File

- name: Deploy configuration file
copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf

This task:

  1. Takes a configuration file from the automation server
  2. Copies it to the target system
  3. Replaces the existing configuration

Example: Modify Configuration

- name: Set service port
lineinfile:
path: /etc/app/config.conf
line: "port=8080"

This ensures the service runs on the correct port.


Why Configuration Automation is Important

Without automation:

  • Administrators manually edit configuration files
  • Mistakes can occur
  • Systems become inconsistent

Automation guarantees identical configurations across systems.


7. Workflow Step 4 — Starting and Stopping Services

After installation and configuration, services must be controlled.

Services may need to:

  • Start
  • Stop
  • Restart
  • Reload

Ansible automates these actions.


Service Management Module

The most common module is:

service

or

systemd

Example: Start a Service

- name: Start nginx service
service:
name: nginx
state: started

This ensures the service is running.


Example: Stop a Service

- name: Stop nginx service
service:
name: nginx
state: stopped

Example: Restart a Service

- name: Restart nginx service
service:
name: nginx
state: restarted

Example: Enable Service on Boot

- name: Enable service
service:
name: nginx
enabled: yes

This ensures the service starts automatically when the system boots.


8. Example of a Complete Automation Workflow

A typical Ansible playbook might automate the full process.

Example Workflow

---
- name: Configure Web Service
hosts: servers
become: yes tasks: - name: Install nginx
apt:
name: nginx
state: present - name: Create service user
user:
name: webadmin
state: present - name: Deploy configuration
copy:
src: nginx.conf
dest: /etc/nginx/nginx.conf - name: Start nginx service
service:
name: nginx
state: started

Workflow Steps

  1. Install required package
  2. Create user account
  3. Deploy configuration file
  4. Start the service

This represents a complete automated infrastructure setup.


9. Order of Tasks in Automation

Ansible runs tasks in sequence.

Typical workflow order:

1️⃣ Install packages
2️⃣ Configure users
3️⃣ Configure services
4️⃣ Start or restart services

Correct ordering ensures the system works properly.

Example:

  • A service cannot start before it is installed.
  • Configuration cannot apply if the software is missing.

10. Idempotency in Ansible Workflows

Ansible follows the concept of idempotency.

This means:

Running the playbook multiple times produces the same result.

Example:

  • If nginx is already installed, Ansible will not reinstall it
  • If a user already exists, Ansible skips creation

Benefits:

  • Safe automation
  • No duplicate actions
  • Consistent infrastructure

11. Recognizing Ansible Workflow in the DEVASC Exam

In the exam, you may see:

  • A playbook snippet
  • YAML code
  • Automation steps

You must identify what workflow is being automated.

Look for these key elements:

Playbook TaskWorkflow Step
apt / yumPackage management
userUser management
copy / templateConfiguration deployment
service / systemdStart/stop services

Understanding these modules helps you recognize the automation process.


12. Key Points to Remember for the Exam

Important Concepts

✔ Ansible automates infrastructure tasks
✔ Playbooks define automation workflows
✔ Tasks run sequentially
✔ Modules perform specific actions


Core Workflow Steps

  1. Package Management
    • Install/remove software
  2. User Management
    • Create service users
    • Manage groups and permissions
  3. Basic Service Configuration
    • Deploy configuration files
    • Modify settings
  4. Service Control
    • Start/stop/restart services
    • Enable services on boot

Most Important Ansible Modules

ModulePurpose
apt, yum, dnfManage packages
userManage user accounts
copyCopy files
templateCreate dynamic configuration files
lineinfileModify configuration lines
serviceManage services

Final Summary

In the Cisco DevNet Associate (200-901 DEVASC) exam, you must understand how Ansible playbooks automate IT workflows.

A typical automated workflow includes:

  1. Installing required software packages
  2. Managing service-related users and permissions
  3. Configuring service settings
  4. Starting, stopping, or restarting services

These tasks are written in YAML playbooks and executed automatically by Ansible.

Understanding how these steps appear in a playbook helps you identify automation workflows, which is an important exam objective.

Buy Me a Coffee