Ansible

  

Ansible目录结构:

  1. /usr/lib/pythonVERSION/site-packages/ansible下生成大量模块
  2. /usr/share/ansible/
  3. /usr/share/doc/ansible-VERSION/
  4. /usr/share/man//man1/ansible
  5. /etc/ansible/ansible.cfg       为配置文件
  6. /etc/ansble/hosts      Inventory
  7. /etc/ansble/roles

 

Ansible常用指令:

  1. ansible-doc -l         list available plugins
  2. ansbile-doc --snippet    
  3. ansible [-f forks] [-m module] [-a arguments]
  4. ansible colloate -m command -a 'hostname'
  5. ansible collocate -m ping            测试节点
  6. ansible collocate -m setup     收集节点信息
  7. ansible-doc --snippet copy
    force(default yes):dest yu src 文件内容不同时,force选项会强制覆盖dest文件
    ansible collocate -m copy -a 'src=pp dest=/tmp/zz mode=7777 owner=halt group=nobody force=yes'
    ansible collocate -m command -a 'ls -l /tmp' 查看result
    ansible collocate -m copy -a 'content="something\nyou like" dest=/tmp/zxc'
  8. ansible collocate -m shell -a 'hostname;date'
  9. ansible collocate -m script -a script_local    

你可能感兴趣的:(Ansible)