ansible 使用
1.openssl x509 -noout -text -in file2. grep -oP 过滤字符串中的指定内容3.setfacl 设置文件权限4.nmcli 配置网络5.iftop 查看网络流量6.nmap 扫描网络、监视主机7.基础命令:find/grep/sed/awk/du/df/ps8.lsof 查看进程打开文件9.grub2-mkconfig 生成 grub.cfg 配置10.find/cpio/gzip/tar 打包文件系统 11.rpm -q[a|f|i|R|l|c][--last]查询选项12.btrfs filesystem resize 修改文件分区大小13.docker/docker-compose 命令使用14.kill 命令重启 php-fpm15.nslookup 域名或IP地址 [DNS服务器]
16.ansible 使用
17.git 命令: 工作区与暂存区18.yum与软件包19.virt-top 命令查看kvm虚拟机的资源使用情况Install
- centos
yum install epel-release -y && yum install ansible -y && ansible --verson
Inventory
example:
[kvm]
192.168.0.51 ansible_port=2222
192.168.0.52 #ansible_port=22222
192.168.0.53 #ansible_port=22222
192.168.0.54 #ansible_port=22222
[kvm:vars]
ansible_user=root
ansible_port=22222
Here are some commonly used SSH variables in Ansible:
* ansible_user: Specifies the SSH user to use when connecting to remote hosts.
* ansible_port: Specifies the SSH port to use when connecting to remote hosts. The default is port 22.
* ansible_private_key_file**: Specifies the path to the private key file to use for SSH authentication.
* ansible_ssh_common_args: Specifies additional SSH command-line arguments to pass to the SSH client.
* ansible_ssh_extra_args: Specifies extra SSH command-line arguments to pass to the SSH client.
* ansible_ssh_timeout: Specifies the SSH connection timeout in seconds.
Note:
when special the group variables, you can also special it in host variables.
Synopsis
# ansible kvm -m shell -a "virsh list --all"
# common options
--list-hosts
outputs a list of matching hosts; does not execute anything else
-i 'file_path'
specify inventory host path (default=/etc/ansible/hosts)
-m 'MODULE_NAME'
module name to execute (default=command)
-f 'FORKS'
specify number of parallel processes to use (default=5)
Note
The "command" module works without a shell by executing the command directly on the remote hosts. So you can use it to excute some simple tasks.
本文作者:武平宁
本文链接:https://www.cnblogs.com/dewan/p/17746279.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步