zoukankan      html  css  js  c++  java
  • ansible常用模块

    模块名字 playbook yaml例子 其他
    ping    
    shell
    - name: 在远程shell中执行远程主机上的脚本;stdout转到远程上的指定文件。
      shell: somescript.sh >> somelog.txt
    - name: 在执行命令之前,将工作目录更改为somedir/。
      shell: somescript.sh >> somelog.txt
      args:
        chdir: somedir/
    - name: 此命令将工作目录更改为somedir/,并且只在somedir/somelog.txt不存在时运行
      shell: somescript.sh >> somelog.txt
      args:
        chdir: somedir/
        creates: somelog.txt
     ansible hostgroup(/etc/ansible/hosts里面的组名) -m shell -a 'ps -ef |grep "lala" '
    copy  
    - name:  using a symbolic mode equivalent to 0644
      copy:
        src: /srv/myfiles/foo.conf
        dest: /etc/foo.conf
        owner: foo
        group: foo
        mode: u=rw,g=r,o=r 或者600
     
     include_vars  -  name: Set OS family dependent variables

       include_vars: '{{ ansible_os_family }}.yml'
       tags: always

     从文件引入变量
     import_tasks  -  import_tasks: yum.yml

        when: ansible_os_family == 'RedHat'
        tags: yum

     导入任务
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
  • 相关阅读:
    (原创) mac 10.9.2 eclipse 的 CDT 的 异常的修复
    (转) Virtual function
    (转) ROS NAMING AND NAMESPACES
    (转) Data structures
    (转) Dynamic memory
    java string类
    eclipse 的快捷键
    java抽象类和接口
    面向对象的三大特征
    Java 中的多态
  • 原文地址:https://www.cnblogs.com/kevincaptain/p/10082854.html
Copyright © 2011-2022 走看看