2.中小型企业通用自动化运维架构 -- Ansible 安装

1.简介

2.配置

1.编辑 /etc/ansible/hosts
  vim /etc/ansible/hosts

  添加主机:
  [centos7-5]
  192.168.0.113

2.将 ansible 主机的 pub key 添加到目标机器

3.测试连通性
	ansible 192.168.0.113 -m ping --user=root

1.以 root 用户登录, 列出目标主机 /root 下的文件
ansible centos7-5 -m shell -a 'ls /root' --user=root
ansible 192.168.0.113 -m shell -a 'ls /root' --user=root



2.ansible 以密码方式登录目标主机,默认为 pub key 登录,需要指出密码选项
ansible centos7-5 -m shell -a 'ls /root' --user=root --ask-pass

3.指定别名
	test ansible_ssh_port=22 ansible_ssh_host=192.168.0.113 ansible_ssh_user=root
1.安装 mariadb
ansible centos7 -m yum -a "name=mariadb-server state=latest"

2.启动 mariadb
ansible centos7 -m systemd -a "name=mariadb state=started"

 

Ansible playbook :

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值