-
Notifications
You must be signed in to change notification settings - Fork 15
First small project to explain docker compose #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,23 +1,155 @@ | ||||||||||||||||||||||||||||||||||||
| # Ansible | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|  | ||||||||||||||||||||||||||||||||||||
| <img src="https://logo.svgcdn.com/logos/ansible.svg" alt="Ansible Logo" width="150" /> | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Overview | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Agentless automation tool for configuration management, application deployment, and task automation. | ||||||||||||||||||||||||||||||||||||
| Ansible is an open-source automation platform used for configuration management, application deployment, orchestration, and provisioning. It allows you to automate repetitive tasks using simple, human-readable YAML files called Playbooks. | ||||||||||||||||||||||||||||||||||||
| Ansible provides agentless automation by connecting to remote systems via SSH (for Linux/macOS hosts) or WinRM (for Windows hosts). | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Key Features | ||||||||||||||||||||||||||||||||||||
| ## Why Ansible? | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - Feature 1 | ||||||||||||||||||||||||||||||||||||
| - Feature 2 | ||||||||||||||||||||||||||||||||||||
| - Feature 3 | ||||||||||||||||||||||||||||||||||||
| - Simple and human-readable | ||||||||||||||||||||||||||||||||||||
| - Agentless | ||||||||||||||||||||||||||||||||||||
| - Scalable from one machine to thousands | ||||||||||||||||||||||||||||||||||||
| - Large module ecosystem | ||||||||||||||||||||||||||||||||||||
| - Cloud provider integrations (AWS, Azure, GCP) | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename section to match required structure. Per the retrieved learnings and coding guidelines, this section should be named "Key Features" rather than "Why Ansible?" to maintain consistency across tool READMEs. Apply this diff: -## Why Ansible?
+## Key Features📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.18.1)15-15: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Key Concepts | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - Inventory | ||||||||||||||||||||||||||||||||||||
| List of hosts and groups Ansible manages. | ||||||||||||||||||||||||||||||||||||
| - Modules | ||||||||||||||||||||||||||||||||||||
| Units of work (e.g., apt, yum, service, copy, win_chocolatey). | ||||||||||||||||||||||||||||||||||||
| - Playbook | ||||||||||||||||||||||||||||||||||||
| YAML file defining tasks to run on hosts. | ||||||||||||||||||||||||||||||||||||
| - Role | ||||||||||||||||||||||||||||||||||||
| Reusable structure for organizing playbooks. | ||||||||||||||||||||||||||||||||||||
| - Control Node | ||||||||||||||||||||||||||||||||||||
| Machine where Ansible is installed/runs. | ||||||||||||||||||||||||||||||||||||
| - Managed Nodes | ||||||||||||||||||||||||||||||||||||
| Machines Ansible operates on. | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Getting Started | ||||||||||||||||||||||||||||||||||||
| ### Installation and basic usage instructions: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ### Ubuntu / Debian | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `sudo apt update` | ||||||||||||||||||||||||||||||||||||
| `sudo apt install ansible -y` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ### CentOS / RHEL / Fedora | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `sudo dnf install ansible -y` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ### Install on macOS | ||||||||||||||||||||||||||||||||||||
| Using Homebrew (recommended): | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `brew update` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `brew install ansible` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ### Verify installation: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible --version` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ### Install on Windows | ||||||||||||||||||||||||||||||||||||
| Ansible does not run natively on Windows as a control node. | ||||||||||||||||||||||||||||||||||||
| However, use Windows Subsystem for Linux (WSL) (Recommended) and run the commands above. | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Basic Usage | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Test connectivity to localhost (if supported): | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible localhost -m ping` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Run a simple command: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible all -i inventory.ini -m shell -a "uptime"` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Working with Inventory | ||||||||||||||||||||||||||||||||||||
| inventory.ini | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||
| [webservers] | ||||||||||||||||||||||||||||||||||||
| 192.168.1.10 | ||||||||||||||||||||||||||||||||||||
| 192.168.1.11 | ||||||||||||||||||||||||||||||||||||
| [dbservers] | ||||||||||||||||||||||||||||||||||||
| db01 ansible_host=192.168.1.20 ansible_user=root | ||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+73
to
+83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add language specification to code blocks. Multiple code blocks are missing language specifications, violating MD040 linting rules. The inventory block at line 76 should specify Apply this diff: ## Working with Inventory
inventory.ini
-```
+```ini
[webservers]
192.168.1.10
192.168.1.11🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| YAML Inventory (optional) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||
| all: | ||||||||||||||||||||||||||||||||||||
| hosts: | ||||||||||||||||||||||||||||||||||||
| local: | ||||||||||||||||||||||||||||||||||||
| ansible_connection: local | ||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+84
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specify language for YAML inventory block. The YAML inventory code block at line 86 is missing the language tag. Apply this diff: YAML Inventory (optional)
-```
+```yaml
all:
hosts:
local:
ansible_connection: local🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| ## Running Ad-Hoc Commands | ||||||||||||||||||||||||||||||||||||
| Check disk space | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible all -m shell -a "df -h"` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Install a package | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible webservers -m apt -a "name=nginx state=present" --become` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Writing Your First Playbook | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||||||
| - name: Install NGINX on web servers | ||||||||||||||||||||||||||||||||||||
| hosts: webservers | ||||||||||||||||||||||||||||||||||||
| become: yes | ||||||||||||||||||||||||||||||||||||
| tasks: | ||||||||||||||||||||||||||||||||||||
| - name: Install nginx | ||||||||||||||||||||||||||||||||||||
| apt: | ||||||||||||||||||||||||||||||||||||
| name: nginx | ||||||||||||||||||||||||||||||||||||
| state: present | ||||||||||||||||||||||||||||||||||||
| update_cache: yes | ||||||||||||||||||||||||||||||||||||
| - name: Ensure nginx is running | ||||||||||||||||||||||||||||||||||||
| service: | ||||||||||||||||||||||||||||||||||||
| name: nginx | ||||||||||||||||||||||||||||||||||||
| state: started | ||||||||||||||||||||||||||||||||||||
| enabled: yes | ||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+101
to
+120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specify language for Ansible playbook block. The playbook code block at line 103 is missing the language tag. It should be Apply this diff: ## Writing Your First Playbook
-```
+```yaml
---
- name: Install NGINX on web servers
hosts: webservers🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Run the playbook: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible-playbook -i inventory.ini site.yml` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Common Use Cases | ||||||||||||||||||||||||||||||||||||
| - Server provisioning | ||||||||||||||||||||||||||||||||||||
| - Installing and configuring applications | ||||||||||||||||||||||||||||||||||||
| - CI/CD automation | ||||||||||||||||||||||||||||||||||||
| - Cloud resource provisioning (AWS/GCP/Azure) | ||||||||||||||||||||||||||||||||||||
| - User/ servers and permission management | ||||||||||||||||||||||||||||||||||||
| - Patching and system updates | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Troubleshooting | ||||||||||||||||||||||||||||||||||||
| Check connection issues: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible all -m ping -vvv` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Check WinRM configuration for Windows: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible windows -m win_ping` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Dry run a playbook: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible-playbook site.yml --check` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Syntax check: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| `ansible-playbook site.yml --syntax-check` | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Installation and basic usage instructions. | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| ## Resources | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - [Official Website](https://example.com) | ||||||||||||||||||||||||||||||||||||
| - [Documentation](https://docs.example.com) | ||||||||||||||||||||||||||||||||||||
| - [Ansible Documentation](https://docs.ansible.com) | ||||||||||||||||||||||||||||||||||||
| - [GitHub Repository](https://github.com/example/Ansible) | ||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| FROM alpine:latest | ||
|
|
||
| RUN mkdir /data | ||
|
|
||
| VOLUME ["/data"] | ||
|
|
||
| CMD ["sleep", "infinity"] | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use relative logo path per coding guidelines.
The logo reference must use a relative path (
../logos/ansible.svg) instead of an absolute CDN URL, as specified in the coding guidelines for tool READMEs.Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents