zoukankan      html  css  js  c++  java
  • 3

    1. Overview
      At this post we will reveal below ansible modules and get them on practice with examples
      command copy file
      user group service
      script setup  





    2. Ansible module - command

      Example: Run command to get ip address from remote server
      Execute below command from shell-master node, ansible will post the command to specified inventory node for execution:

      ansible webservers -m command -a "ip addr"

    3. Ansible module - copy
      [root@shell-master ~]# ansible-doc -s copy
      - name: Copy files to remote locations

      Example: Copy local file to remote target server

      First we create 1 simple file on shell-master

      Then using Ansible copy module copy it to remote server
      [root@shell-master ~]# ansible webservers -m copy -a "src=copy-to-remote.txt dest=/tmp/ mode=755 owner=wayne"

      Once the command finished, login back to shell-node1 check if the file been copied to required location as required:

    4. Ansible module - file
      [root@shell-master ~]# ansible-doc -s file
      - name: Manage files and file properties

      Example: Let's update the file attribute we just copied to remote server from step 3
      Run below command, to change the file's owner from wayne to root, change the access mode from 755 to 777

      [root@shell-master ~]# ansible webservers -m file -a "path=/tmp/copy-to-remote.txt owner=root mode=777"

      After the command done for running, go back to shell-node1, verify if the file properties been updated:

  • 相关阅读:
    [Shoi2007]Vote 善意的投票
    [CQOI2015]任务查询系统
    [SDOI2013]森林
    HttpClient 教程 (二)
    /system改成可写
    Netbeans 6.8 + apktool_2.0.0b9 动态调试smali文件
    把中文版NetBeans改成英文版
    ZjDroid工具介绍及脱壳详细示例
    grep过滤搜索
    android Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
  • 原文地址:https://www.cnblogs.com/waynewei/p/15112010.html
Copyright © 2011-2022 走看看