centos 7.2 安装ansible

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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容