Network Automation (Ansible, Python Scripts)
You need to automate the configuration of multiple network devices using Ansible. Which Ansible module is commonly used to send CLI commands to network devices?
Ios_command
Ping
Yum
Service
In a Python script, you want to establish an SSH connection to a network device and execute a command. Which library would you typically use?
Requests
Paramiko
Pandas
Numpy
When using Ansible to manage network devices, what is the purpose of the ansible_host variable?
It defines the username for device access.
It specifies the device’s IP address or hostname.
It sets the Ansible playbook path.
It determines the timeout for device connections.
You have written a Python script to automate network device configuration. Which method is commonly used to handle errors during SSH connections?
Try-except
If-else
For-while
Case-switch
In an Ansible playbook, how do you ensure a task runs with elevated privileges?
Use the become directive.
Set ansible_sudo to yes.
Use the elevate command.
Enable sudo_mode.
Which Python library would you use to parse and work with JSON data received from an API call?
Sys
Os
Json
Time
You need to automate the backup of network device configurations using a Python script. Which of the following libraries would you use to schedule the script to run daily?
Datetime
Schedule
Os
Re
You are debugging an Ansible playbook and need to print a variable’s value. Which task would you include in your playbook?
Print: variable_name
Show: variable_name
Debug: var=variable_name
Log: variable_name
When automating network configuration changes, why is it important to use version control systems like Git?
To collaborate with other team members.
To track and revert changes if necessary.
To ensure only one person can make changes.
To avoid writing scripts from scratch.
In a Python script, which module would you use to run shell commands and capture their output?
Shutil
Pathlib
Logging
Subprocess
Which Ansible command is used to check the syntax of a playbook without executing it?
Ansible-playbook --check
Ansible --dry-run
Ansible --verify
Ansible-playbook --syntax-check
When using Python to interact with network devices via REST APIs, which library is most commonly used for making HTTP requests?
Urllib
Http.client
Http.server
Requests
In Ansible, what is the purpose of the inventory file?
To define the list of hosts and groups Ansible can manage.
To store playbook tasks.
To configure Ansible logging.
To set environment variables.
Which Python module is useful for creating, reading, and updating YAML files often used in Ansible playbooks?
Yaml
Pyyaml
Snakeyaml
Ruamel.yaml
You need to ensure your Ansible playbook only runs tasks on devices in the web group. Which keyword would you use in your playbook?
Devices: web
Group: web
Hosts: web
Target: web
In a Python automation script, how do you safely handle sensitive information such as passwords?
Hardcode the passwords in the script.
Use environment variables or configuration files with restricted access.
Include passwords in comments for reference.
Store passwords in plain text files.
In Ansible, how can you run a task only if a certain condition is true?
Using the if directive.
Using the check directive.
Using the assert directive.
Using the when directive.
Which Python library would you use to automate interactions with web pages, such as logging into a web-based network management tool?
Beautifulsoup
Pandas
Selenium
Numpy
In Ansible, which command do you use to execute a playbook?
Ansible-playbook playbook.yml
Ansible run playbook.yml
Ansible-play run playbook.yml
Ansible execute playbook.yml
When automating network tasks with Python, which library can be used to work with the NETCONF protocol?
Netmiko
Ncclient
Pyshark
Paramiko
In an Ansible playbook, how do you specify a task that should run on all hosts in a specific group?
Hosts: all
Targets: group_name
Hosts: group_name
Devices: all
Which Python module is designed to create and manipulate complex regular expressions for tasks such as parsing log files?
Match
Parse
Regex
Re
What is the primary function of the ansible-galaxy command?
To manage Ansible roles and collections.
To execute playbooks.
To start the Ansible service.
To test playbooks for syntax errors.
In Python, which function would you use to read the contents of a file line by line?
Read()
Readlines()
Readfile()
Readline()
When using Ansible, what is the purpose of the handlers section in a playbook?
To list all hosts and groups.
To set global playbook variables.
To define tasks that run only when notified.
To specify environment settings.
In Python, which method is used to send an HTTP GET request using the requests library?
Requests.fetch()
Requests.put()
Requests.post()
Requests.get()
When automating network device configurations with Python, which library provides a simplified API for working with NETCONF?
Pyshark
Paramiko
Netmiko
Ncclient
In an Ansible playbook, how do you define a variable that can be used across multiple tasks?
Parameters
Vars
Config
Variables
Which Python library can be used to interact with and control Cisco devices through CLI commands?
Pyserial
Paramiko
Subprocess
Netmiko
In Ansible, what does the ansible_facts variable store?
The output of the last executed command.
System information gathered from managed hosts.
Error messages from failed tasks.
Global configuration settings.
When writing a Python script to automate network tasks, which module allows you to run commands on remote systems via SSH?
Netmiko
Subprocess
Paramiko
Pexpect
Which Ansible command-line option allows you to limit execution to a specific set of hosts?
-l (or --limit)
-i (or --inventory)
-t (or --target)
-h (or --hosts)
Which Python library provides functions for interacting with network devices using SNMP?
Netmiko
Paramiko
Pysnmp
Pyshark
In Ansible, how do you create a new directory on a remote host?
Use the copy module with src: directory.
Use the file module with state: directory.
Use the directory module.
Use the command module with args: mkdir.
When using Python scripts for network automation, which module helps with creating and managing SSH tunnels?
Paramiko
Subprocess
Netmiko
Sshtunnel
In Ansible, which module is used to retrieve files from remote hosts to the control machine?
Pull
Get
Copy
Fetch
When automating tasks with Ansible, what is the purpose of the become_method directive?
To define the user for task execution.
To specify how to escalate privileges.
To declare the task dependencies.
To set environment variables.
Which Python function is used to serialize an object into a JSON formatted string?
Json.load()
Json.parse()
Json.dumps()
Json.serialize()
In Ansible, what is the meta module used for?
To transfer files.
To install software packages.
To gather facts about the system.
To manage the state of Ansible playbooks and roles.
When using Python for network automation, which method of the requests library would you use to send data in an HTTP POST request?
Requests.get()
Requests.post()
Requests.send()
Requests.put()
Which Ansible module can be used to manage the configuration of network devices through the RESTCONF protocol?
Restconf
Httpapi
Netconf
Uri
When writing a Python script to automate network device configuration changes, which approach ensures the script is idempotent?
Always force the changes without checking.
Execute the changes multiple times.
Check the current configuration before making changes.
Use random values for each execution.
In Ansible, what is the purpose of the hosts keyword in a playbook?
To define the user credentials for the tasks.
To specify the target hosts for the playbook execution.
To determine the order of task execution.
To set global variables for the playbook.
Which Python library allows you to send ICMP (ping) requests and handle the responses?
Scapy
Paramiko
Netmiko
Ping3
{"name":"Network Automation (Ansible, Python Scripts)", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"You need to automate the configuration of multiple network devices using Ansible. Which Ansible module is commonly used to send CLI commands to network devices?, In a Python script, you want to establish an SSH connection to a network device and execute a command. Which library would you typically use?, When using Ansible to manage network devices, what is the purpose of the ansible_host variable?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
More Quizzes
Quiz 5
840
Roman quiz
1260
Which Dropout Are You?
5286
The Whimsical Quiz of Jumbled Questions
4224
What Is Your Type of Guy: Find Your Perfect Match
201024904
Gate Control Theory of Pain - Test Your Knowledge
201039572
Chemical vs Physical Change: Test Your Science Skills
201031937
Ultimate Perceptive Test: Is Your Perception on Point?
201036052
Seminar in Works of Select Composer
15820131
Discover Your Dream Wedding Style - Wedding Planning
201026049
Free Property Sales Knowledge
201021495
HACCP Online Exam: Challenge Your Team Training Knowledge
201027893