zoukankan      html  css  js  c++  java
  • ansible-playbook


    [root@s19master ansible]# ansible-playbook  f4.yml --list-hosts

    playbook: f4.yml

      play #1 (dball): dball    TAGS: []
        pattern: [u'dball']
        hosts (2):
          192.168.16.235
          192.168.16.133
    [root@s19master ansible]# ansible-playbook  f4.yml --list-tasks

    playbook: f4.yml

      play #1 (dball): dball    TAGS: []
        tasks:
          yum install httpd    TAGS: []
          copy a configure file    TAGS: []
          start apache service    TAGS: []


    [root@s19master ansible]# ansible-playbook  -C f4.yml

    PLAY [dball] ************************************************************************************************************************************************

    TASK [Gathering Facts] **************************************************************************************************************************************
    ok: [192.168.16.133]
    ok: [192.168.16.235]

    TASK [yum install httpd] ************************************************************************************************************************************
    ok: [192.168.16.133]
    ok: [192.168.16.235]

    TASK [copy a configure file] ********************************************************************************************************************************
    changed: [192.168.16.133]
    changed: [192.168.16.235]

    TASK [start apache service] *********************************************************************************************************************************
    ok: [192.168.16.235]
    ok: [192.168.16.133]

    RUNNING HANDLER [restart service] ***************************************************************************************************************************
    changed: [192.168.16.133]
    changed: [192.168.16.235]

    PLAY RECAP **************************************************************************************************************************************************
    192.168.16.133             : ok=5    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
    192.168.16.235             : ok=5    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


    [root@s19master ansible]# ansible-playbook   f4.yml  --limit 192.168.16.235

    PLAY [dball] ************************************************************************************************************************************************

    TASK [Gathering Facts] **************************************************************************************************************************************
    ok: [192.168.16.235]

    TASK [yum install httpd] ************************************************************************************************************************************
    ok: [192.168.16.235]

    TASK [copy a configure file] ********************************************************************************************************************************
    changed: [192.168.16.235]

    TASK [start apache service] *********************************************************************************************************************************
    ok: [192.168.16.235]

    RUNNING HANDLER [restart service] ***************************************************************************************************************************
    changed: [192.168.16.235]

    PLAY RECAP **************************************************************************************************************************************************
    192.168.16.235             : ok=5    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   


    [root@s19master ansible]# ansible-playbook   f4.yml

    PLAY [dball] ************************************************************************************************************************************************

    TASK [Gathering Facts] **************************************************************************************************************************************
    ok: [192.168.16.133]
    ok: [192.168.16.235]

    TASK [yum install httpd] ************************************************************************************************************************************
    ok: [192.168.16.133]
    ok: [192.168.16.235]

    TASK [copy a configure file] ********************************************************************************************************************************
    changed: [192.168.16.235]
    changed: [192.168.16.133]

    TASK [start apache service] *********************************************************************************************************************************
    ok: [192.168.16.235]
    ok: [192.168.16.133]

    RUNNING HANDLER [restart service] ***************************************************************************************************************************
    changed: [192.168.16.133]
    changed: [192.168.16.235]

    PLAY RECAP **************************************************************************************************************************************************
    192.168.16.133             : ok=5    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
    192.168.16.235             : ok=5    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   



    [root@s19master ansible]# cat f4.yml
    ---
            - hosts: dball
              remote_user: root
              
              tasks:
              - name: yum install httpd
                yum: name=httpd
                ignore_errors: yes
              - name: copy a configure file
                copy: src=conf/httpd.conf dest=/etc/httpd/conf/httpd.conf backup=yes
                notify: restart service
              - name: start apache service  
                service: name=httpd state=started enabled=yes

              handlers:
              - name: restart service
                service: name=httpd state=restarted


  • 相关阅读:
    ippicv_windows_20151201.zip免费分享地址
    C++获取电脑上连接的多个摄像头名称与编号
    Opencv Laplacian(拉普拉斯算子)
    Java3D-对象基本变换
    opencv3更换图片背景
    解析IFC数据并存储到关系型数据库
    opencv生成灰度图并保存
    opencv3.2加载图片
    matlab rand(3,5)
    水利工程建设标准强制性条文 2016
  • 原文地址:https://www.cnblogs.com/duoduoyichen/p/11054998.html
Copyright © 2011-2022 走看看