zoukankan      html  css  js  c++  java
  • ansible copy模块

    copy 模块:
    
    tasks:
      - name: Copy ansible inventory file to client
        copy: src=/etc/ansible/hosts dest=/etc/ansible/hosts
                owner=root group=root mode=0644
    
    [root@node01 ansible]# cat playbook.yml
    - hosts: database
      tasks:
      - name: Copy ansible inventory file to client
        copy: src=/etc/ansible/hosts dest=/etc/ansible/hosts
                owner=mqm group=mqm mode=777
    [root@node01 ansible]# ansible-playbook  playbook.yml
    [DEPRECATION WARNING]: DEFAULT_SUDO_USER option, In favor of become which is a generic framework . This feature will be removed in version 2.8. Deprecation warnings can be disabled by 
    setting deprecation_warnings=False in ansible.cfg.
    
    PLAY [database] *******************************************************************************************************************************************************************************
    
    TASK [Gathering Facts] ************************************************************************************************************************************************************************
    ok: [192.168.137.3]
    
    TASK [Copy ansible inventory file to client] **************************************************************************************************************************************************
    changed: [192.168.137.3]
    
    PLAY RECAP ************************************************************************************************************************************************************************************
    192.168.137.3              : ok=2    changed=1    unreachable=0    failed=0   
    
    [root@node01 ansible]# 
    
    查看192.168.137.3 上的文件:
    
    node2:/etc/ansible#ls -ltr
    total 4
    -rwxrwxrwx 1 mqm mqm 84 Oct 11 00:15 hosts
    node2:/etc/ansible#

  • 相关阅读:
    51nod 最长公共子序列Lcs
    输入挂
    HDU 圆桌会议
    畅通工程
    异形卵
    Python中的多态如何理解?(转帖,让我很理解。)【外加自我看法】(这次修改后应该就是标准答案了)
    Python短路逻辑or的巧妙使用。
    Python三元表达式
    稍微记号下Python的赋值技巧。
    刚看到一个字符串的替换命令,makeslate,记号一下(用处大?应该不算)!
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349476.html
Copyright © 2011-2022 走看看