الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

الفصل 5الاسم في الدورة: IaC and cloud

Build infrastructure from code (IaC and cloud CLIs)

Clicking in a cloud portal is fine to learn, but real teams build networks, VMs, clusters and databases from code: reviewed, repeatable and easy to rebuild. Terraform builds, Ansible configures, Packer makes images, cloud-init does the first boot, and the cloud CLIs do everything else.

  • 6 الدروس
  • 8 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

المهارات في هذا الفصل

  • البنية ككود وأدوات السحابة — 6

5.1

Terraform — cloud resources as code

terraform compares .tf code with the state and the real world, shows a plan, and applies it through providers (Azure, AWS, Kubernetes, GitHub).

terraform init
terraform fmt -recursive && terraform validate
terraform plan -out tfplan
terraform apply tfplan
terraform plan -detailed-exitcode

Security checklist:

  • Remote state with locking (Azure Storage, S3); state holds secrets — restrict access.
  • Never commit *.tfstate or secret *.tfvars; commit .terraform.lock.hcl.
  • Scan with trivy config . or Checkov in every PR; review every plan.

5.2

Ansible — configure servers over SSH

ansible runs idempotent modules on many servers from YAML playbooks, without an agent.

ansible all -i inventory.ini -m ping
ansible-playbook -i inventory.ini site.yml --check --diff
ansible-playbook -i inventory.ini site.yml -l web1 -t nginx
ansible-vault edit group_vars/db/vault.yml

Security checklist:

  • Secrets in Ansible Vault or a secret manager lookup.
  • Use modules, not shell; run ansible-lint in CI.

الأوامر في هذا الدرس

5.3

Packer — golden images

packer builds a hardened VM image (Azure, AWS, QEMU) from code, so every server starts from the same patched base.

packer init . && packer validate .
packer build -var-file=prod.pkrvars.hcl .

Security checklist:

  • Deprovision at the end (SSH host keys, history, machine ID).
  • No secrets baked into images; rebuild monthly.

الأوامر في هذا الدرس

5.4

cloud-init — the first boot

cloud-init reads user-data at the first boot of a cloud VM and creates users, SSH keys, packages and files.

cloud-init schema -c user-data.yaml --annotate
cloud-init status --wait --long
tail -50 /var/log/cloud-init-output.log

Security checklist:

  • User-data is readable inside the VM: no secrets in it.
  • ssh_pwauth: false, disable_root: true.

5.5

Azure CLI — manage Azure

az manages subscriptions, resource groups, VMs, networks, storage, AKS, Key Vault and RBAC — the main tool for AZ-104 and scripts.

az login && az account set --subscription "Lab Subscription"
az group create -n rg-lab-weu -l westeurope
az aks get-credentials -g rg-lab-weu -n aks-lab
az vm list -d -o table --query "[].{name:name, state:powerState}"

Security checklist:

  • Managed identities and OIDC instead of client secrets.
  • Least-privilege role assignments at the smallest scope; budgets on lab subscriptions.

الأوامر في هذا الدرس

5.6

AWS CLI — manage AWS

aws calls every AWS API; many DevOps jobs ask for basic S3, EC2, IAM and EKS even in Azure teams.

aws sso login --profile lab
aws sts get-caller-identity
aws s3 ls
aws eks update-kubeconfig --name eks-lab --region eu-central-1

Security checklist:

  • No root keys; SSO for people, OIDC roles for CI.
  • Block public S3 access; encryption on by default.

في العمل

A strong portfolio project: Terraform builds the Azure network and AKS, Packer builds the VM image, Ansible hardens it, and a GitHub Actions pipeline runs plan on the PR and apply after approval.

الأوامر في هذا الدرس

كل الأوامر في هذا الفصل