惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Tailwind CSS Blog
有赞技术团队
有赞技术团队
爱范儿
爱范儿
Engineering at Meta
Engineering at Meta
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
L
LangChain Blog
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
P
Proofpoint News Feed
腾讯CDC
GbyAI
GbyAI
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
F
Fortinet All Blogs
Y
Y Combinator Blog
V
V2EX
A
About on SuperTechFans

标签 on 打工人日志

日报 k8s Guide Self-Hosted Automation CLI error linux nginx pve daliy 运维 docker stable diffusion github 测试 gitlab 日常生活 IOS 开发 midjourney ChatGPT skywalking work 周报 基础 oracle brew logstash IPFS web3.0
ansible
2022-04-14 · via 标签 on 打工人日志

ansible 命令 Inventory:Ansible 管理的主机信息,包括 IP 地址、SSH 端口、账号、密码等 Modules:任务均有模块完成,也可以自定义模块,例如经常用的脚本。 Plugins:使用插件增加 Ansible 核心功能,自身提供了很多插件,也可以自定义插件。例如 connection 插件,用于连接目标主机。 Playbooks:“剧本”,模块化定义一系列任务,供外部统一调用。Ansible 核心功能。 编辑主机清单 1[webservers] 2192.168.0.20 ansible_ssh_user=root ansible_ssh_pass=’200271200’ 3192.168.0.21 ansible_ssh_user=root ansible_ssh_pass=’200271200’ 4192.168.0.22 ansible_ssh_user=root ansible_ssh_pass=’200271200’ 5 6[dbservers] 710.12.0.100 810.12.0.101 1sed -i "s/#host_key_checking = .*/host_key_checking = False/g" /etc/ansible/ansible.cfg 命令行 1ansible all -m ping 2ansible all -m shell -a "ls /root" -u root -k 常用模块 在目标主机执行 shell 命令。 shell 1- name: 将命令结果输出到指定文件 2 shell: somescript.sh >> somelog.txt 3- name: 切换目录执行命令 4 shell: 5 cmd: ls -l | grep log 6 chdir: somedir/ 7- name: 编写脚本 8 shell: | 9 if [ 0 -eq 0 ]; then 10 echo yes > /tmp/result 11 else 12 echo no > /tmp/result 13 fi 14 args: 15 executable: /bin/bash copy 将文件复制到远程主机。 1- name: 拷贝文件 2 copy: 3 src: /srv/myfiles/foo.