Curated

Automation, Orchestration, and Scripting

0 votes

Try a few cards

Card 1 of 10

All cards113

  1. What Ansible component lists the managed hosts and groups that playbooks target?

    The inventory. It can be a static INI or YAML file, or generated dynamically from a cloud or other source.

  2. In Puppet, what is a module?

    A module is a self-contained directory of manifests, templates, files, and facts that bundles the code needed to manage one piece of a system. Modules are shared through Puppet Forge and keep classes organized and reusable.

  3. In OpenTofu, what is a provider?

    A plugin that lets OpenTofu communicate with a platform's API to create and manage that platform's resources. Examples include providers for AWS, Azure, and libvirt, which are downloaded when the working directory is initialized.

  4. Which Red Hat-originated file automates the Anaconda installer so an OS install runs without prompts?

    A Kickstart file (ks.cfg). It answers the installer's questions in advance and is passed at boot with the inst.ks= parameter.

  5. What is the core practice of continuous integration (CI)?

    Developers frequently merge code changes into a shared repository, where each merge triggers an automated build and test run. This surfaces integration defects early, while changes are still small and easy to fix.

  6. Which Kubernetes object is the smallest deployable unit, wrapping one or more containers that share network and storage?

    A Pod. Containers in the same Pod share an IP address and can share volumes, and Pods are usually managed by a higher-level object such as a Deployment.

  7. In Docker Swarm, what is a task?

    A task is a single running container that carries out part of a service, scheduled onto a specific node. A service with three replicas therefore produces three tasks.

  8. Which Compose command creates and starts all services defined in the Compose file?

    docker compose up (or podman compose up). Adding -d runs the containers in the background, detached from the terminal.

  9. In Bash, which syntax runs a command and substitutes its output into the command line?

    Command substitution, written $(command) or with backticks `command`. The $(...) form is preferred because it nests cleanly and is easier to read.

  10. What are the two valid syntaxes for defining a function in Bash?

    name() { commands; } and function name { commands; }. Both create a reusable command group that runs in the current shell, and the definition must appear before the function is called.

  11. Which command makes a bash read split input fields on commas?

    IFS=',' read -r a b c — assigning IFS on the same line as read sets the separator for that command only. The original IFS value is left unchanged for the rest of the script.

  12. Which keyword closes an if block in a Bash script?

    fi, which is "if" spelled backward. Every if statement must end with fi, just as every case statement ends with esac.

  13. Which Bash loop keyword repeats its body until a condition command returns exit status 0?

    The until loop. It is the inverse of while, which repeats as long as the condition returns exit status 0, so until [ "$count" -ge 5 ] runs while count is below 5.

  14. What two-character sequence at the start of a script marks its interpreter line?

    #! (called the shebang), followed by the interpreter's absolute path, such as #!/bin/bash. The kernel reads this first line to decide which program runs the script when it is executed directly.

  15. Which test operator checks whether integer $a is strictly greater than integer $b in [ ]?

    -gt is the operator, as in [ "$a" -gt "$b" ]. Symbols like > in single brackets compare strings or act as redirection, not numbers.

  16. Which Bash test operator matches a string against an extended regular expression inside [[ ]]?

    The =~ operator, as in [[ $foo =~ regex ]]. It returns exit status 0 on a match and 1 otherwise, and it stores capture groups in the BASH_REMATCH array.

  17. Which test operator returns true if a string has zero length?

    The -z operator, as in [ -z "$var" ]. Its counterpart -n returns true when the string is non-empty, so always quote the variable to avoid syntax errors on empty values.

  18. Which special shell variable holds the exit status of the last executed command?

    $? holds the exit status of the most recent foreground command. A value of 0 means success, and any nonzero value (1-255) indicates failure or a specific error condition.

  19. Which command creates a Python virtual environment named .venv in the current directory?

    python3 -m venv .venv. After running it, activate the environment with source .venv/bin/activate, and pip will then install packages into that environment only.

  20. Which Python data type is the value 3.14?

    Floating point (float). It holds numbers with a decimal point, while whole numbers like 3 are integers (int).

  21. How many spaces per indentation level does PEP 8 recommend in Python code?

    Four spaces per indentation level. PEP 8 discourages tabs, and Python 3 raises an error when tabs and spaces are mixed in indentation.

  22. Which Git command downloads remote changes without merging them into your current branch?

    git fetch. It updates remote-tracking branches such as origin/main, so you can inspect changes before running git merge or git rebase.

  23. Which AI use case turns a plain-language description into a draft regex pattern?

    Regular expression generation. AI can draft a pattern from a described match, but you must test it against sample input before relying on it.

  24. What should you do with AI-generated shell scripts before running them on production systems?

    Review and test them first, ideally in a non-production environment. AI output can contain errors, insecure commands, or hallucinated options, so a human must verify it before use.

  25. What prompt-writing technique supplies sample inputs and outputs so the AI imitates the desired format?

    Few-shot prompting. Providing two or three worked examples in the prompt shows the model the exact output pattern, such as a specific log format or config layout, that you want it to follow.

  26. In Ansible, a collection is the file that defines the list of managed hosts and groups that a playbook targets.

    The inventory defines managed hosts and groups. A collection is a distribution format that bundles Ansible content such as modules, plugins, roles, and playbooks, and it does not list targets. Confusing the two is common because both are referenced by playbooks.

  27. In Puppet, facts are values that the Puppet server defines in the manifests and then sends to each agent to control how the agent's catalog is compiled.

    Facts are collected from each node by Facter and reported to the Puppet server, which uses them when compiling that node's catalog. The statement reverses the direction: facts flow from agent to server, not from manifests to the agent.

  28. In OpenTofu, the state file defines the desired infrastructure configuration that OpenTofu applies to the target platform.

    The state file records the real-world resources OpenTofu manages and maps them to the configuration. The desired infrastructure is defined in the configuration files. OpenTofu compares configuration with state to plan changes.

  29. Cloud-init is the tool used to automate disk partitioning and package selection during a bare-metal operating system installation from installation media.

    Kickstart drives the installer for unattended partitioning and package selection on media-based installs. Cloud-init is tempting because it is also unattended, but it runs at first boot of an existing cloud image, setting hostname, users, SSH keys and packages from user data.

  30. What distinguishes continuous deployment from continuous delivery?

    Continuous deployment automatically releases every passing build to production, while continuous delivery keeps builds releasable but requires a manual approval step. Frequent merging describes continuous integration, and reconciling state from Git describes GitOps.

  31. Which Kubernetes object stores non-sensitive configuration data as key-value pairs for pods to consume?

    A ConfigMap holds non-sensitive configuration as key-value pairs that pods read as environment variables or mounted files. A Secret is similar but is intended for sensitive data such as passwords and tokens.

  32. Which network driver lets Swarm services communicate across multiple Docker hosts?

    The overlay driver creates a distributed network spanning all nodes in the swarm, so services on different hosts can reach each other. The bridge driver only connects containers on a single Docker host.

  33. Running docker compose down stops and removes the containers and default network for a project, and it also deletes the project's named volumes by default.

    Named volumes are preserved by default when running docker compose down. They are removed only if the --volumes (-v) option is added. Containers and the default network are removed by default, so that part of the statement is accurate.

  34. In Bash, enclosing commands in parentheses, as in (cd /tmp; pwd), runs them in the current shell, so the directory change remains in effect after the parentheses close.

    Parentheses start a subshell, a child process, so the cd affects only that subshell and the parent shell stays in its original directory. Running the commands in the current shell requires braces, as in { cd /tmp; pwd; }.

  35. In a Bash script, a function can be called before its definition appears in the file, because Bash reads the entire script and registers every function before executing the first command.

    Bash reads and executes a script line by line, so a function exists only after its definition has been executed. Calling it earlier in the file fails with "command not found"; the definition must come before the first call.

  36. In a bash script, the command IFS=',' read -r a b c <<< "$line" changes the field separator for the rest of the script after the read command finishes.

    A variable assignment placed directly before a command applies only to that command's environment, so IFS returns to its previous value once read completes. To change IFS for the rest of the script, assign it on its own line, such as IFS=','.

  37. In a Bash case statement, each pattern list is ended with a single semicolon, and the entire case block is closed with the keyword done.

    Each case clause ends with a double semicolon (;;), and the block is closed with esac, which is case spelled backward. The keyword done closes loops such as for, while and until, which is the tempting mix-up.

  38. A Bash until loop runs its body as long as the test command returns exit status 0, and stops when the test command returns a nonzero status.

    This is reversed. An until loop runs its body while the test command returns a nonzero status and stops once it returns 0. A while loop is the one that continues while the test returns 0, which is why the two are easily confused.

  39. A script that begins with the line #!/bin/bash and is run through its file name is interpreted by the kernel loading /bin/bash, and the shebang line must be placed after a blank line at the top of the file for it to take effect.

    The shebang must be the very first two bytes of the file, with no blank line or whitespace before it. If anything precedes #!, the kernel does not treat it as an interpreter directive, and the line is read as a plain comment by the shell.

  40. In a Bash script, the test [ "$count" -le 10 ] evaluates as true only when the value of $count is greater than or equal to 10.

    The -le operator means "less than or equal to," so the test is true when $count is 10 or lower. The statement reverses the direction; -ge is the operator that checks for greater than or equal to.

  41. In Bash, the expression [[ $foo =~ regex ]] returns exit status 0 when the pattern is not found anywhere in the value of foo.

    The =~ operator returns 0 (true) when the string matches the extended regular expression, and 1 when it does not match. A match can occur anywhere in the string unless anchored with ^ or $. The statement reverses the meaning of the exit status.

  42. Which test operator returns true if a path exists and is a directory?

    -d is true when the path exists and is a directory. -f is the tempting wrong choice because it is true only for a regular file.

  43. Which command makes a shell variable available to child processes?

    export marks a variable for inheritance by child processes' environment. local only limits scope to a function, unset removes a variable, and alias defines a command shortcut.

  44. After a virtual environment is activated with source .venv/bin/activate, running pip install -r requirements.txt installs the listed packages into the system-wide site-packages directory.

    False. Activation places the environment's bin directory first in PATH, so pip installs the packages into the virtual environment's own site-packages directory, leaving the system-wide Python installation unchanged. System-wide installation would require using the system pip outside the environment.

  45. In Python, the value True is stored as a string data type.

    True is a Boolean (bool) value, which has only two possible values: True and False. A string would be written in quotes, such as "True", which is a different object and does not behave as a Boolean in conditions.

  46. PEP 8 recommends that function and variable names use CamelCase, such as BackupLogs, while class names use lowercase letters with underscores.

    The naming conventions are reversed. PEP 8 recommends lowercase with underscores (snake_case) for functions and variables, and CapWords (CamelCase) for class names. Swapping them makes the statement false.

  47. Running git pull is equivalent to running git fetch followed by git reset --hard on the tracking branch.

    By default, git pull is git fetch followed by git merge of the upstream branch into the current branch (or a rebase if configured). It preserves local commits. A hard reset would discard local commits and uncommitted changes.

  48. Asking an AI assistant to flag a Terraform configuration that exposes SSH to 0.0.0.0/0 is an example of using AI for documentation generation.

    False. Identifying a risky setting in infrastructure as code is a security review use case. Documentation generation instead produces readable descriptions of what code does, such as README text, comments, or usage guides, and does not assess risk.

  49. Pasting a production server's configuration files, including embedded credentials, into a public AI chatbot is acceptable as long as the generated answer is reviewed by a human before it is used.

    Human review of the output does not protect the input. Data sent to a public AI service leaves organizational control and may be retained or used for model training, so credentials and sensitive data must be kept out of it. A private or local model, under corporate policy, is the safer choice.

  50. Which prompt element tells the AI to act as a senior Linux administrator?

    Role assignment sets the persona and expertise level the AI adopts when answering. Background context supplies situational details such as the distribution or task, but does not define a persona.