ansible
SolidAnsible 自动化运维
DevOps & Infrastructure 1 stars
0 forks Updated yesterday Apache-2.0
Install
Quality Score: 79/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Ansible 自动化运维
## 概述
Playbook 编写、角色管理、动态 inventory 等技能。
## 基础命令
### Ad-hoc 命令
```bash
# 测试连通性
ansible all -m ping
ansible webservers -m ping
# 执行命令
ansible all -m command -a "uptime"
ansible all -m shell -a "df -h | grep /dev"
# 复制文件
ansible all -m copy -a "src=/local/file dest=/remote/file"
# 安装软件
ansible all -m apt -a "name=nginx state=present" --become
ansible all -m yum -a "name=nginx state=present" --become
# 管理服务
ansible all -m service -a "name=nginx state=started" --become
# 收集信息
ansible all -m setup
ansible all -m setup -a "filter=ansible_distribution*"
```
### 常用参数
```bash
-i inventory # 指定 inventory
-m module # 指定模块
-a arguments # 模块参数
-b, --become # 提权
-K # 询问 sudo 密码
-u user # 指定用户
-k # 询问 SSH 密码
--limit host # 限制主机
-v, -vv, -vvv # 详细输出
--check # 检查模式(不执行)
--diff # 显示差异
```
## Inventory
### 静态 inventory
```ini
# inventory/hosts
[webservers]
web1.example.com
web2.example.com ansible_host=192.168.1.10
[dbservers]
db1.example.com ansible_user=admin
db2.example.com
[production:children]
webservers
dbservers
[all:vars]
ansible_python_interpreter=/usr/bin/python3
```
### YAML 格式
```yaml
# inventory/hosts.yml
all:
children:
webservers:
hosts:
web1.example.com:
web2.example.com:
ansible_host: 192.168.1.10
dbservers:
hosts:
db1.example.com:
ansible_user: adm...
Details
- Author
- ryukyagamilight
- Repository
- ryukyagamilight/terminal-skills
- Created
- 5 months ago
- Last Updated
- yesterday
- Language
- N/A
- License
- Apache-2.0
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Solid
ansible-playbook-diagnostics-runner
Runs Ansible diagnostic playbooks using ansible-runner and the Ansible Collections ecosystem (ansible.builtin, community.general). Captures system health, service status, and log analysis across inventory hosts.
20 Updated today
agentskillexchange AI & Automation Solid
kubectl-basics
kubectl 基础操作与常用命令
1 Updated yesterday
ryukyagamilight AI & Automation Solid
ansible-playbook-dry-run-analyzer
Executes ansible-playbook --check --diff mode and parses the JSON callback output using the ansible.posix.json callback plugin. Identifies tasks that would change, predicts idempotency issues, and generates change impact reports.
20 Updated today
agentskillexchange