2.安装ansible 在服务器端: 先安装epel源,下载路径https://fedoraproject.org/wiki/EPEL 找到epel-releaselatest-7下载 执行yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install ansible -y 3.被控制端 被控制端安装如下软件 yum install libselinux-python -y 4...
5.file模块: 创建文件目录 ansible db -m file -a "path=/tmp/test state=touch" 6.yum模块:yum安装目录 ansible web -m yum -a 'name="@Development tools" state=present' 7.service模块: ansible web -m service -a 'enabled=yes name=httpd state=started' 8.shell模块: 命令模块,比command好用一...
1.环境准备 操作系统:Centos7 Python版本: Python 2.6 或 Python 2.7 2.设置EPEL仓库 通过Yum安装RPMs适用于 EPEL 6, 7。Ansible仓库默认不在yum仓库中,因此我们需要使用下面的命令启用epel仓库 rpm -iUvhhttp://dl.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm 3.使用yum安装Ansibl...
ansible 10.0.224.1 -m cron -a 'name="ntpetest" minute=*/3 hour=* day=* month=* weekday=* job="/usr/sbin/ntpdate 10.0.224.1" user=weblogic' ---group模块 在指定节点上创建一个组名为nolinux,gid为2014的组 ansible 10.0.224.1 -m goup -a 'gid=2014 name=nolinux' ---user模块 在指...
rpm -ivh createrepo-0.9.9-28.el7.noarch.rpm cd /tmp createrepo ansible 3、编辑yum文件 vim /etc/yum.repos.d/ansible.repo [ansible]name=ansible baseurl=file:///tmp/ansiblegpgcheck=0enabled=1 4、安装ansible yum install ansible -y
默认使用yum安装的ansible是基于python2.7版本,很多功能指令都是调用python完成的,默认情况下会调用/usr/bin/python下的版本。 python升级至新的版本之后,会增加新的模块、特性,调用方式也不一样。 因此,每个版本的python升级之后,都需要将ansible升级至对应的版本,直接使用pip install ansible即可。
配置yum源使用Centos-stream.repo 上传到 /etc/yum.repos.d/目录 下载链接Centos-stream.repo 然后清理缓存 yum clean all yum makecahe 等待安装 使用ansible --version去验证 [root@server ~]# ansible --version ansible [core 2.12.7] config file = /etc/ansible/ansible.cfg configured module search path...
ansible工具 方法/步骤 1 部署两台centos7系统:192.168.1.8作为ansible节点192.168.1.4作为服务节点 2 在服务节点编写yum配置文件: [server]name=serverbaseurl=file:///mntgpgcheck=0enabled=1 3 在服务节点准备yum源 4 在ansible节点编写yml脚本:--- name: install hosts: 192.168.1.4 tasks: ...
yum -y install wget yum-utils createrepo createrepo:用于生成yum源各软件之间的依赖索引。 yum-utils:安装后可使用 yumdownloader 命令下载所需软件包。 reposync:Reposync用于将远程yum存储库同步到本地,使用yum检索包的目录 2、配置yum源 下载阿里源 ...
yum install -y --cacheonly --disablerepo=* /u01/software/openssl/*.rpm 也可以创建本地仓库 vi /etc/yum.repos.d/local.repo [local] name=ansible baseurl=file:///u01/software/openssl gpgcheck=0 enabled=1cd/u01/software/ createrepo openssl ...