美文网首页
centos 7.2 安装ansible

centos 7.2 安装ansible

作者: stormzhai | 来源:发表于2018-06-06 18:06 被阅读23次

1、安装ansible

yum -y install ansible

2、配置

vi /etc/ansible/hosts
[web]
web1 ansible_ssh_port=22 ansible_ssh_host=10.0.0.1 ansible_ssh_user=root ansible_ssh_pass=vagrant

3、命令

ansible web -a 'ls /home'
ansible web -m ping
ansible web -m copy -a "src=/tmp/server dest=/tmp/server"
ansible web -m file -a "dest=/tmp/server mode=755 owner=root group=root"
ansible web -m yum -a "name=ntpd state=installed"

4、ansible-playbook

ansible-playbook mysql_delete.yml -e "host=web user=root"

想要测试某条任务

- name: ChunkMgn | create set | ck_new_set
  shell: cd {{ chunkkeeper.bin }} && ./ChunkMgn create {{ superadmin.username }} {{ set.id }} {{ set.hosts }}
  tags:
    - test

ansible-playbook mysql_install.yml -e "host=web user=root" --tags=test

5、安装mysql(centos7.2测试)

mysql安装文件地址
密码: 36qf

相关文章

网友评论

      本文标题:centos 7.2 安装ansible

      本文链接:https://www.haomeiwen.com/subject/oghisftx.html