ansible的安装方法与基本使用
发表于:2024-09-22 作者:千家信息网编辑
千家信息网最后更新 2024年09月22日,本篇内容主要讲解"ansible的安装方法与基本使用",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"ansible的安装方法与基本使用"吧!服务端安装ans
千家信息网最后更新 2024年09月22日ansible的安装方法与基本使用
本篇内容主要讲解"ansible的安装方法与基本使用",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"ansible的安装方法与基本使用"吧!
服务端安装ansible
[root@k8s-mater]yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm[root@k8s-mater]yum install ansible -y[root@k8s-master ansible]# ansible --helpUsage: ansible[options]Options: -a MODULE_ARGS, --args=MODULE_ARGS module arguments -k, --ask-pass ask for SSH password --ask-su-pass ask for su password -K, --ask-sudo-pass ask for sudo password --ask-vault-pass ask for vault password -B SECONDS, --background=SECONDS run asynchronously, failing after X seconds (default=N/A) -C, --check don't make any changes; instead, try to predict some of the changes that may occur -c CONNECTION, --connection=CONNECTION connection type to use (default=smart) -f FORKS, --forks=FORKS specify number of parallel processes to use (default=5) -h, --help show this help message and exit -i INVENTORY, --inventory-file=INVENTORY specify inventory host file (default=/etc/ansible/hosts) -l SUBSET, --limit=SUBSET further limit selected hosts to an additional pattern --list-hosts outputs a list of matching hosts; does not execute anything else -m MODULE_NAME, --module-name=MODULE_NAME module name to execute (default=command) -M MODULE_PATH, --module-path=MODULE_PATH specify path(s) to module library (default=/usr/share/ansible/) -o, --one-line condense output -P POLL_INTERVAL, --poll=POLL_INTERVAL set the poll interval if using -B (default=15) --private-key=PRIVATE_KEY_FILE use this file to authenticate the connection -S, --su run operations with su -R SU_USER, --su-user=SU_USER run operations with su as this user (default=root) -s, --sudo run operations with sudo (nopasswd) -U SUDO_USER, --sudo-user=SUDO_USER desired sudo user (default=root) -T TIMEOUT, --timeout=TIMEOUT override the SSH timeout in seconds (default=10) -t TREE, --tree=TREE log output to this directory -u REMOTE_USER, --user=REMOTE_USER connect as this user (default=root) --vault-password-file=VAULT_PASSWORD_FILE vault password file -v, --verbose verbose mode (-vvv for more, -vvvv to enable connection debugging) --version show program's version number and exit
配置hosts,便于后续操控远程主机
cd /etc/ansiblevim hosts## db-[99:101]-node.example.com192.168.189.89
编辑/etc/ansible/ansible.cfg
inventory = /etc/ansible/hosts #将注释#去掉
测试命令
[root@k8s-master ansible]# ansible localhost -m pinglocalhost | SUCCESS => { "changed": false, "ping": "pong"}[root@k8s-master ansible]# ansible localhost -m command -a "df -h"localhost | CHANGED | rc=0 >>文件系统 容量 已用 可用 已用% 挂载点/dev/mapper/centos-root 17G 5.5G 12G 33% /devtmpfs 475M 0 475M 0% /devtmpfs 487M 124K 487M 1% /dev/shmtmpfs 487M 14M 473M 3% /runtmpfs 487M 0 487M 0% /sys/fs/cgroup/dev/sda1 1014M 133M 882M 14% /boottmpfs 98M 0 98M 0% /run/user/0
到此,相信大家对"ansible的安装方法与基本使用"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
方法
内容
学习
实用
更深
主机
兴趣
命令
实用性
实际
容量
操作简单
文件
更多
朋友
注释
系统
网站
频道
服务
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全2020手抄报内容文字
网络安全结构示意图
数据库自定义函数和存储过程区别
幼儿大班网络安全教育内容
恐怖黎明失去服务器连接
阿里云网络安全几级
网络技术基础总结论文
网络安全事件分级响应
怎么获取数据库的密码
数据库 热备用状态
药品广告数据库意可贴
服务器系统错误码6008
软件开发发展前景怎么写
宝可梦服务器
我的世界建筑服务器
银行外包软件开发
校园安全网络安全应急预案
qq空间服务器数据失败
scada软件开发工程师
医疗软件开发上有专利证书吗
博博软件开发选哪家
数据库建表的规定
无锡现代软件开发注意事项
魔域出现服务器中断
通信网络技术发展应用
杭电网络安全调剂
nas网络存储服务器软件
网络维护与网络安全公务员岗位
软件开发 增值税专票
633网络技术基础是哪本书