dargslan-devops-quiz 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/index.js +129 -0
  4. package/package.json +21 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dargslan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # 🐳 Dargslan DevOps & Cloud Quiz
2
+
3
+ [![npm](https://img.shields.io/npm/v/dargslan-devops-quiz)](https://www.npmjs.com/package/dargslan-devops-quiz)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ **Interactive DevOps & Cloud quiz right in your terminal.** Test your knowledge of Docker, Kubernetes, Terraform, Ansible, CI/CD, AWS, and more.
7
+
8
+ ## Quick Start
9
+
10
+ ```bash
11
+ npx dargslan-devops-quiz
12
+ ```
13
+
14
+ ## Features
15
+
16
+ - 🎯 **34+ expert questions** across 6 categories
17
+ - 🐳 **Docker & Containers** β€” images, volumes, networking, compose
18
+ - ☸️ **Kubernetes** β€” pods, deployments, services, ingress, statefulsets
19
+ - πŸ”„ **CI/CD** β€” GitHub Actions, pipelines, GitOps, canary deployments
20
+ - πŸ—οΈ **Terraform & IaC** β€” plan, state, modules, import
21
+ - πŸ“‹ **Ansible** β€” playbooks, roles, Galaxy, agentless architecture
22
+ - ☁️ **Cloud & AWS** β€” VPC, S3, EBS, security groups, Well-Architected
23
+ - πŸ† **4 game modes** β€” Quick, Full, By Category, Speed Round
24
+ - πŸ’‘ Detailed explanations after each answer
25
+ - πŸ“– Personalized book recommendations
26
+ - πŸš€ Zero dependencies
27
+
28
+ ## Who Is This For?
29
+
30
+ - πŸŽ“ **CKA/CKS/AWS/Azure** certification candidates
31
+ - πŸ’Ό **DevOps engineer** interview prep
32
+ - πŸ–₯️ **Developers** transitioning to DevOps
33
+ - πŸ“š **Students** learning cloud infrastructure
34
+
35
+ ## More Tools
36
+
37
+ - 🐧 `npx dargslan-linux-quiz` β€” General Linux
38
+ - βš™οΈ `npx dargslan-sysadmin-quiz` β€” System Administration
39
+ - πŸ”’ `npx dargslan-security-quiz` β€” Cybersecurity
40
+ - πŸ“– `npx linux-cheatsheet-cli` β€” Command Reference
41
+ - πŸ›‘οΈ `npx server-hardening-checklist` β€” Security Audit
42
+
43
+ ## Learn More
44
+
45
+ - πŸ“š [210+ IT eBooks](https://dargslan.com/books)
46
+ - πŸ“„ [260+ Cheat Sheets](https://dargslan.com/cheat-sheets)
47
+ - πŸ“ [IT Blog](https://dargslan.com/blog)
48
+
49
+ ## License
50
+
51
+ MIT β€” [dargslan.com](https://dargslan.com)
package/index.js ADDED
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env node
2
+
3
+ const readline = require('readline');
4
+
5
+ const c = {
6
+ reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
7
+ red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m',
8
+ blue: '\x1b[34m', magenta: '\x1b[35m', cyan: '\x1b[36m', white: '\x1b[37m',
9
+ bgGreen: '\x1b[42m', bgRed: '\x1b[41m',
10
+ };
11
+
12
+ const CATEGORIES = [
13
+ { name: 'Docker & Containers', icon: '🐳' },
14
+ { name: 'Kubernetes', icon: '☸️' },
15
+ { name: 'CI/CD', icon: 'πŸ”„' },
16
+ { name: 'Terraform & IaC', icon: 'πŸ—οΈ' },
17
+ { name: 'Ansible & Config Mgmt', icon: 'πŸ“‹' },
18
+ { name: 'Cloud & AWS', icon: '☁️' },
19
+ ];
20
+
21
+ const QUESTIONS = [
22
+ { category: 0, difficulty: 1, question: 'What is a Docker container?', options: ['A virtual machine', 'A lightweight isolated process using the host kernel', 'A physical server', 'A network device'], answer: 1, explanation: 'Containers share the host OS kernel and isolate processes using namespaces and cgroups β€” much lighter than VMs.' },
23
+ { category: 0, difficulty: 1, question: 'Which command builds a Docker image from a Dockerfile?', options: ['docker create', 'docker build -t name .', 'docker make', 'docker compile'], answer: 1, explanation: '`docker build -t imagename .` builds an image from the Dockerfile in the current directory.' },
24
+ { category: 0, difficulty: 2, question: 'What is a Docker volume used for?', options: ['CPU allocation', 'Persistent data storage that survives container restarts', 'Network configuration', 'Image layers'], answer: 1, explanation: 'Volumes persist data outside the container lifecycle. Use `docker volume create` and mount with `-v`.' },
25
+ { category: 0, difficulty: 2, question: 'What is a multi-stage Docker build?', options: ['Building multiple images', 'Using multiple FROM statements to reduce final image size', 'Running builds in parallel', 'Building for multiple platforms'], answer: 1, explanation: 'Multi-stage builds use intermediate stages for compilation, copying only artifacts to the final slim image.' },
26
+ { category: 0, difficulty: 3, question: 'How does Docker networking bridge mode work?', options: ['Direct host access', 'Creates a virtual bridge (docker0) connecting containers on a private subnet', 'Uses VLAN tagging', 'Tunnels to cloud'], answer: 1, explanation: 'Bridge mode creates docker0 network bridge. Containers get private IPs and use NAT for external access.' },
27
+ { category: 0, difficulty: 2, question: 'What is Docker Compose used for?', options: ['Building images faster', 'Defining and running multi-container applications', 'Container monitoring', 'Image compression'], answer: 1, explanation: 'Docker Compose uses a YAML file to define services, networks, and volumes for multi-container apps.' },
28
+ { category: 0, difficulty: 3, question: 'What is the difference between CMD and ENTRYPOINT in a Dockerfile?', options: ['No difference', 'CMD provides defaults that can be overridden; ENTRYPOINT sets the main executable', 'CMD runs first', 'ENTRYPOINT is deprecated'], answer: 1, explanation: 'ENTRYPOINT defines the executable. CMD provides default arguments that can be overridden at runtime.' },
29
+ { category: 1, difficulty: 1, question: 'What is a Kubernetes Pod?', options: ['A cluster', 'The smallest deployable unit with one or more containers', 'A network policy', 'A storage class'], answer: 1, explanation: 'A Pod wraps one or more containers that share networking (same IP) and storage volumes.' },
30
+ { category: 1, difficulty: 2, question: 'What does a Kubernetes Deployment provide?', options: ['Storage only', 'Declarative updates, scaling, and rollback for Pods', 'Network routing', 'Authentication'], answer: 1, explanation: 'Deployments manage ReplicaSets, enabling rolling updates, rollbacks, and scaling of Pod replicas.' },
31
+ { category: 1, difficulty: 2, question: 'What is a Kubernetes Service?', options: ['A background job', 'A stable network endpoint to access a set of Pods', 'A config file', 'A monitoring tool'], answer: 1, explanation: 'Services provide stable DNS names and IPs for Pod access. Types: ClusterIP, NodePort, LoadBalancer.' },
32
+ { category: 1, difficulty: 3, question: 'What is a Kubernetes Ingress?', options: ['An internal process', 'An API object managing external HTTP/HTTPS access to services', 'A storage driver', 'A security policy'], answer: 1, explanation: 'Ingress provides URL-based routing, SSL termination, and virtual hosting for external traffic.' },
33
+ { category: 1, difficulty: 3, question: 'What is a StatefulSet used for?', options: ['Stateless apps', 'Applications needing stable identities and persistent storage', 'Batch jobs', 'Network policies'], answer: 1, explanation: 'StatefulSets maintain Pod identity (stable hostname, ordered deployment) for databases and stateful apps.' },
34
+ { category: 1, difficulty: 2, question: 'What does `kubectl get pods -A` show?', options: ['Only failed pods', 'All pods across all namespaces', 'Pod templates', 'Pod metrics'], answer: 1, explanation: '`-A` (or `--all-namespaces`) shows pods from every namespace, not just the current one.' },
35
+ { category: 2, difficulty: 1, question: 'What does CI stand for in CI/CD?', options: ['Container Integration', 'Continuous Integration', 'Code Inspection', 'Cloud Infrastructure'], answer: 1, explanation: 'Continuous Integration automatically builds and tests code changes when committed to version control.' },
36
+ { category: 2, difficulty: 1, question: 'What does CD stand for in CI/CD?', options: ['Code Deployment', 'Continuous Delivery/Deployment', 'Container Distribution', 'Cloud Distribution'], answer: 1, explanation: 'Continuous Delivery automates release preparation. Continuous Deployment automatically deploys to production.' },
37
+ { category: 2, difficulty: 2, question: 'In GitHub Actions, what is a workflow?', options: ['A Git branch', 'An automated process defined in a YAML file triggered by events', 'A PR review', 'A deployment target'], answer: 1, explanation: 'Workflows are defined in `.github/workflows/*.yml` and triggered by events like push, PR, or schedule.' },
38
+ { category: 2, difficulty: 2, question: 'What is a pipeline artifact?', options: ['Source code', 'A build output (binary, image, report) saved between stages', 'A test case', 'A configuration file'], answer: 1, explanation: 'Artifacts are files produced during a pipeline stage that can be used in later stages or downloaded.' },
39
+ { category: 2, difficulty: 3, question: 'What is GitOps?', options: ['Git hosting', 'Using Git as the single source of truth for infrastructure and deployments', 'GitHub integration', 'Git performance tuning'], answer: 1, explanation: 'GitOps uses Git repos for declarative infrastructure. Changes are applied automatically via reconciliation (ArgoCD, Flux).' },
40
+ { category: 2, difficulty: 3, question: 'What is a canary deployment?', options: ['Full rollout', 'Gradually routing a small percentage of traffic to the new version', 'Rollback strategy', 'Blue-green switching'], answer: 1, explanation: 'Canary deployments send a small % of traffic to the new version, monitoring for issues before full rollout.' },
41
+ { category: 3, difficulty: 1, question: 'What is Infrastructure as Code (IaC)?', options: ['Manual server setup', 'Managing infrastructure through machine-readable config files', 'Coding on servers', 'Infrastructure monitoring'], answer: 1, explanation: 'IaC uses code to provision and manage infrastructure, enabling version control, repeatability, and automation.' },
42
+ { category: 3, difficulty: 2, question: 'What does `terraform plan` do?', options: ['Creates resources', 'Shows what changes Terraform will make without applying them', 'Destroys resources', 'Downloads providers'], answer: 1, explanation: '`terraform plan` is a dry-run that previews changes. Always review the plan before running `terraform apply`.' },
43
+ { category: 3, difficulty: 2, question: 'What is Terraform state?', options: ['Current server status', 'A file tracking the mapping between config and real resources', 'A deployment log', 'A backup'], answer: 1, explanation: 'State (terraform.tfstate) tracks which real resources correspond to your config. Store it remotely (S3, GCS).' },
44
+ { category: 3, difficulty: 3, question: 'What are Terraform modules?', options: ['Plugins', 'Reusable, self-contained packages of Terraform configurations', 'State files', 'Provider credentials'], answer: 1, explanation: 'Modules are reusable infrastructure components. Use the Terraform Registry or create custom modules.' },
45
+ { category: 3, difficulty: 3, question: 'What is `terraform import` used for?', options: ['Installing Terraform', 'Bringing existing infrastructure under Terraform management', 'Importing modules', 'Loading variables'], answer: 1, explanation: '`terraform import` adds existing resources to state without recreating them β€” essential for adopting IaC.' },
46
+ { category: 4, difficulty: 1, question: 'What is Ansible primarily used for?', options: ['Container orchestration', 'Configuration management and automation', 'Version control', 'Monitoring'], answer: 1, explanation: 'Ansible automates configuration management, application deployment, and task automation using YAML playbooks.' },
47
+ { category: 4, difficulty: 2, question: 'What is an Ansible playbook?', options: ['A Python script', 'A YAML file defining tasks to execute on hosts', 'A config file', 'A test suite'], answer: 1, explanation: 'Playbooks define plays (target hosts + tasks) in YAML. Tasks use modules like apt, copy, service, etc.' },
48
+ { category: 4, difficulty: 2, question: 'Does Ansible require agents on managed nodes?', options: ['Yes, always', 'No, it is agentless and uses SSH', 'Only on Linux', 'Only for Windows'], answer: 1, explanation: 'Ansible is agentless β€” it connects via SSH (Linux) or WinRM (Windows), requiring no software on targets.' },
49
+ { category: 4, difficulty: 3, question: 'What is an Ansible role?', options: ['A user permission', 'A structured way to organize playbooks into reusable components', 'A host group', 'A variable type'], answer: 1, explanation: 'Roles organize tasks, handlers, variables, templates, and files into a standard directory structure.' },
50
+ { category: 4, difficulty: 3, question: 'What is Ansible Galaxy?', options: ['A monitoring tool', 'A community hub for sharing and downloading roles and collections', 'A testing framework', 'A cloud service'], answer: 1, explanation: 'Galaxy (galaxy.ansible.com) hosts community-contributed roles and collections. Install with `ansible-galaxy install`.' },
51
+ { category: 5, difficulty: 1, question: 'What are the 3 main cloud service models?', options: ['SaaS, PaaS, IaaS', 'Public, Private, Hybrid', 'CPU, RAM, Storage', 'Dev, Staging, Prod'], answer: 0, explanation: 'IaaS (infrastructure), PaaS (platform), SaaS (software). Examples: EC2, Heroku, Gmail.' },
52
+ { category: 5, difficulty: 2, question: 'What is an AWS Security Group?', options: ['IAM policy', 'A virtual firewall controlling inbound/outbound traffic for instances', 'An S3 bucket policy', 'A VPN group'], answer: 1, explanation: 'Security Groups act as instance-level firewalls with allow rules. They are stateful (return traffic auto-allowed).' },
53
+ { category: 5, difficulty: 2, question: 'What is the difference between S3 and EBS?', options: ['No difference', 'S3 is object storage; EBS is block storage attached to EC2', 'EBS is cheaper', 'S3 is faster'], answer: 1, explanation: 'S3 stores objects (files) via HTTP API. EBS provides block-level volumes that mount to EC2 instances like hard drives.' },
54
+ { category: 5, difficulty: 3, question: 'What is AWS VPC peering?', options: ['Load balancing', 'Connecting two VPCs to route traffic between them privately', 'DNS resolution', 'Auto scaling'], answer: 1, explanation: 'VPC peering creates a private network connection between two VPCs without going through the public internet.' },
55
+ { category: 5, difficulty: 3, question: 'What is the AWS Well-Architected Framework?', options: ['A coding standard', 'Best practices across 6 pillars: operational excellence, security, reliability, performance, cost, sustainability', 'An AWS service', 'A deployment tool'], answer: 1, explanation: 'The framework provides architectural best practices for building secure, high-performing, resilient, and efficient infrastructure.' },
56
+ ];
57
+
58
+ const BOOKS = {
59
+ low: [
60
+ { title: 'Docker Essentials', url: 'https://dargslan.com/book/docker-essentials' },
61
+ { title: 'Linux for Absolute Beginners', url: 'https://dargslan.com/book/linux-for-absolute-beginners' },
62
+ ],
63
+ mid: [
64
+ { title: 'Kubernetes in Practice', url: 'https://dargslan.com/book/kubernetes-in-practice' },
65
+ { title: 'Linux Administration Fundamentals', url: 'https://dargslan.com/book/linux-administration-fundamentals' },
66
+ ],
67
+ high: [
68
+ { title: 'Advanced Kubernetes', url: 'https://dargslan.com/book/advanced-kubernetes' },
69
+ { title: 'Linux System Hardening', url: 'https://dargslan.com/book/linux-system-hardening' },
70
+ ],
71
+ };
72
+
73
+ function shuffle(a){const b=[...a];for(let i=b.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[b[i],b[j]]=[b[j],b[i]];}return b;}
74
+ function ask(rl,q){return new Promise(r=>rl.question(q,a=>r(a.trim())));}
75
+
76
+ async function main(){
77
+ const rl=readline.createInterface({input:process.stdin,output:process.stdout});
78
+ console.log(`\n${c.bold}${c.cyan} ╔══════════════════════════════════════════════════╗`);
79
+ console.log(` β•‘${c.white} 🐳 DARGSLAN DEVOPS & CLOUD QUIZ ☁️ ${c.cyan}β•‘`);
80
+ console.log(` β•‘${c.dim}${c.white} Docker, K8s, Terraform, CI/CD & more ${c.cyan}β•‘`);
81
+ console.log(` β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•${c.reset}\n`);
82
+ console.log(`${c.dim} Powered by dargslan.com β€” 210+ IT eBooks${c.reset}\n`);
83
+
84
+ console.log(` ${c.green}[1]${c.reset} Quick (10) ${c.yellow}[2]${c.reset} Full (34) ${c.cyan}[3]${c.reset} Category ${c.red}[4]${c.reset} Speed\n`);
85
+ const mode=parseInt(await ask(rl,` ${c.bold}Choice [1-4]: ${c.reset}`))||1;
86
+
87
+ let qs;
88
+ if(mode===2)qs=shuffle(QUESTIONS);
89
+ else if(mode===3){
90
+ console.log('');CATEGORIES.forEach((cat,i)=>console.log(` [${i+1}] ${cat.icon} ${cat.name}`));
91
+ const ci=(parseInt(await ask(rl,`\n ${c.bold}Category [1-6]: ${c.reset}`))||1)-1;
92
+ qs=shuffle(QUESTIONS.filter(q=>q.category===ci));
93
+ }else if(mode===4)qs=shuffle(QUESTIONS).slice(0,15);
94
+ else qs=shuffle(QUESTIONS).slice(0,10);
95
+
96
+ if(!qs.length){console.log(' No questions!');rl.close();return;}
97
+
98
+ let correct=0;const labels=['A','B','C','D'];
99
+ for(let i=0;i<qs.length;i++){
100
+ const q=qs[i];const cat=CATEGORIES[q.category];
101
+ const stars=q.difficulty===1?'β˜…β˜†β˜†':q.difficulty===2?'β˜…β˜…β˜†':'β˜…β˜…β˜…';
102
+ const dc=q.difficulty===1?c.green:q.difficulty===2?c.yellow:c.red;
103
+ console.log(`\n${c.dim}${'─'.repeat(60)}${c.reset}`);
104
+ console.log(` ${c.bold}Q${i+1}/${qs.length}${c.reset} | ${cat.icon} ${cat.name} | ${dc}${stars}${c.reset}`);
105
+ console.log(`\n ${c.bold}${q.question}${c.reset}\n`);
106
+ q.options.forEach((o,j)=>console.log(` ${c.cyan}${labels[j]}${c.reset}) ${o}`));
107
+ let ans;
108
+ if(mode===4){
109
+ console.log(`\n ${c.yellow}⏱ 15 seconds!${c.reset}`);
110
+ ans=await Promise.race([ask(rl,`\n ${c.bold}Answer [A-D]: ${c.reset}`),new Promise(r=>setTimeout(()=>r(''),15000))]);
111
+ }else ans=await ask(rl,`\n ${c.bold}Answer [A-D]: ${c.reset}`);
112
+ const ai=labels.indexOf(ans.toUpperCase());
113
+ if(ai===q.answer){correct++;console.log(` ${c.bgGreen}${c.white}${c.bold} βœ“ CORRECT ${c.reset}`);}
114
+ else console.log(` ${c.bgRed}${c.white}${c.bold} βœ— WRONG ${c.reset} Answer: ${labels[q.answer]}) ${q.options[q.answer]}`);
115
+ console.log(` ${c.dim}πŸ’‘ ${q.explanation}${c.reset}`);
116
+ }
117
+
118
+ const pct=Math.round(correct/qs.length*100);const sc=pct>=80?c.green:pct>=60?c.yellow:c.red;
119
+ console.log(`\n${c.bold}${c.cyan} ═══════════ RESULTS ═══════════${c.reset}`);
120
+ console.log(`\n Score: ${sc}${c.bold}${correct}/${qs.length} (${pct}%)${c.reset}\n`);
121
+ const books=pct>=80?BOOKS.high:pct>=60?BOOKS.mid:BOOKS.low;
122
+ console.log(` ${c.bold}Recommended:${c.reset}`);
123
+ books.forEach(b=>console.log(` πŸ“– ${b.title}\n ${c.cyan}${b.url}${c.reset}`));
124
+ console.log(`\n πŸ“š 210+ eBooks: ${c.cyan}https://dargslan.com/books${c.reset}`);
125
+ console.log(` πŸ“„ Cheat Sheets: ${c.cyan}https://dargslan.com/cheat-sheets${c.reset}`);
126
+ console.log(`\n${c.dim} Made with ❀ by Dargslan β€” dargslan.com${c.reset}\n`);
127
+ rl.close();
128
+ }
129
+ main().catch(console.error);
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "dargslan-devops-quiz",
3
+ "version": "1.0.0",
4
+ "description": "Interactive DevOps & Cloud quiz in your terminal. 40+ questions on Docker, Kubernetes, Terraform, Ansible, CI/CD, AWS, and more.",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "dargslan-devops-quiz": "./index.js",
8
+ "devops-quiz": "./index.js"
9
+ },
10
+ "keywords": [
11
+ "devops", "docker", "kubernetes", "terraform", "ansible", "quiz", "terminal", "cli",
12
+ "cicd", "jenkins", "github-actions", "aws", "azure", "cloud", "containers",
13
+ "infrastructure", "learning", "certification", "practice"
14
+ ],
15
+ "author": "Dargslan <info@dargslan.com> (https://dargslan.com)",
16
+ "license": "MIT",
17
+ "homepage": "https://dargslan.com",
18
+ "repository": { "type": "git", "url": "https://github.com/Dargslan/dargslan-devops-quiz" },
19
+ "engines": { "node": ">=14.0.0" },
20
+ "files": ["index.js", "README.md", "LICENSE"]
21
+ }