This section covers fundamental concepts in automation and scripting, including basic Bash commands, Python scripting, YAML syntax, and introductory Groovy concepts.
What is automation in DevOps?
Automation in DevOps refers to scripting repetitive tasks like provisioning, configuration, deployment, and monitoring to improve efficiency and reduce errors.
What are the benefits of scripting in DevOps?
Reduces manual effort
Increases consistency and repeatability
Improves efficiency and speed
Reduces errors and enhances security
What is Bash scripting?
Bash scripting is writing command-line instructions in a script file (.sh) to automate tasks in Unix/Linux environments.
How do you write a basic Bash script?
#!/bin/bashecho "Hello, DevOps!"
Save the file (script.sh), make it executable (chmod +x script.sh), and run it (./script.sh).
What is the difference between Bash and Shell scripting?
Bash is a type of shell, but shell scripting can also be done in other shells like sh, csh, and zsh. Bash provides more advanced scripting features.
What are variables in Bash?
Variables store values and are defined without a $ sign but accessed using $.
name="DevOps"echo "Hello, $name"
What is Python scripting used for in DevOps?
Infrastructure as Code (IaC)
CI/CD automation
Log analysis
Cloud automation (AWS, Azure, GCP SDKs)
How do you define a function in Python?
def greet(): print("Hello, DevOps!")greet()
What is YAML, and where is it used?
YAML (Yet Another Markup Language) is a human-readable format used for Kubernetes configurations, Ansible playbooks, CI/CD pipelines, etc.