Automation, Scripting, and Virtualization Flashcards
7 cards from real SAC practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Automation, Scripting, and Virtualization flashcards as text
What is the function of an Ansible 'handler' in a playbook?
Answer: A task triggered by a 'notify' directive that runs only once at the end of a play if notified
Handlers are special tasks that execute after all tasks complete, but only if notified by at least one changed task.
Which Python library is commonly used to run shell commands from within a Python script and capture their output?
Answer: subprocess
The subprocess module (especially subprocess.run() and subprocess.Popen()) executes external commands and captures stdout/stderr.
In KVM/QEMU virtualization, which tool provides a command-line interface for managing virtual machines, networks, and storage pools?
Answer: virsh
virsh is the command-line interface to the libvirt daemon, allowing admins to start, stop, snapshot, and configure VMs.
A sysadmin wants a script to process only lines containing the word 'FAILED' in a log file. Which command achieves this most efficiently?
Answer: grep 'FAILED' logfile
Calling grep directly on the file is more efficient than piping cat output, avoiding a useless use of cat (UUOC).
What does 'overcommitment' mean in the context of virtual machine memory management?
Answer: Assigning more total VM RAM than the physical host actually has installed
Memory overcommitment relies on techniques like ballooning and transparent huge pages to allow total VM RAM to exceed physical RAM.
Which Puppet resource type is used to ensure a system package is installed on managed nodes?
Answer: package
The Puppet 'package' resource type manages software package installation, removal, and version enforcement across nodes.
In Bash scripting, which syntax correctly defines an array and then accesses its second element?
Answer: arr=(a b c); echo ${arr[1]}
Bash arrays use parentheses for definition and ${array[index]} syntax (with curly braces) for element access; arrays are zero-indexed.