zoukankan      html  css  js  c++  java
  • ansible模块详解

        1  ps aux |grep 18816
        2  kill -9 18816
        3  date
        4  cd /tmp
        5  ls
        6  find -name test.log
        7  find ./ -name test.log
        8  cat test.log 
        9  ping 192.168.31.218
       10  ping -c1 192.168.31.218
       11  cd /application/xqd/
       12  ls
       13  vim 9.sh
       14  ls
       15  cat a.sh
       16  vim 9.sh
       17  chmod +x 9.sh 
       18  ./9.sh 
       19  vim 9.sh
       20  ./9.sh 
       21  vim 9.sh
       22  ./9.sh 
       23  lss
       24  ls
       25  cat ip.txt 
       26  ls
       27  vim 10.sh
       28  chmod 10.
       29  chmod 10.sh 
       30  chmod +x 10.sh 
       31  ./10.sh 
       32  vim 10.sh 
       33  ./10.sh 
       34  vim 10.sh 
       35  ./10.sh 
       36  vim 10.sh 
       37  ./10.sh 
       38  ./10.sh install
       39  ./10.sh start
       40  ls
       41  vim 11.sh
       42  chmod +x 11.sh 
       43  ./11.sh root
       44  ./11.sh
       45  vim 10.sh 
       46  ./10.sh start
       47  echo $
       48  ./10.sh install
       49  echo $?
       50  systemctl status crontab
       51  systemctl status crond
       52  crontab -e -u root
       53  date +%F_%T
       54  echo date +%F_%T
       55  echo `date +%F_%T`
       56  crontab -e -u root
       57  crontab -l
       58  tail -f /var/log/cron
       59  crontab -e -u root
       60  crontab -l
       61  tail -f /var/log/cron
       62  ls
       63  vim /etc/ansible/hosts
       64  ping 47.114.150.49
       65  ping -c1 47.114.150.49
       66  ssh-copy-id -i ~/.ssh/id_rsa.pub root@47.114.150.49
       67  ssh 47.114.150.49
       68  ansible ali -a 'useradd alex'
       69  id alex
       70  ansible ali -a 'echo "456" | passwd --stdin alex'
       71  ansible-doc -s command
       72  ansible-doc  command
       73  ansible-doc shell
       74  ansible-doc -s shell
       75  ansible ali -m shell -a 'echo "123" | passwd --stdin alex'
       76  ansible ali -m shell -a 'echo "456" | passwd --stdin alex'
       77  cd /application/
       78  ls
       79  cd xqd/
       80  ls
       81  vim 1.sh 
       82  ansible ali -m shell -a 'bash 1.sh'
       83  ansible ali -m shell -a 'bash /application/xqd/1.sh'
       84  vim 1.sh 
       85  cat a.sh
       86  vim b.sh
       87  ansible ali -m shell -a 'bash /application/xqd/b.sh'
       88  ansible ali -m shell -a 'bash /application/a.sh'
       89  ansible ali -m shell -a '/application/a.py'
       90  ls
       91  cat b.sh 
       92  vim b.sh 
       93  chmod +x b.sh 
       94  ls
       95  ansible-doc -s script
       96  ansible all -m script -a '/application/xqd/b.sh'
       97  ansible all -m shell -a 'ls /application/'
       98  ls
       99  vim b.sh 
      100  ansible all -m script -a 'removes=/application/wwh /application/xqd/b.sh'
      101  ansible all -m shell -a 'ls /application/'
      102  ansible all -m script -a 'removes=/application/a.sh  /application/xqd/b.sh'
      103  ansible all -m shell -a 'ls /application/'
      104  ansible all -m script -a 'creates=/application/a.sh  /application/xqd/b.sh'
      105  vim b.sh 
      106  ansible all -m script -a 'creates=/application/a.sh  /application/xqd/b.sh'
      107  ansible all -m script -a 'creates=/application/wwh  /application/xqd/b.sh'
      108  ansible all -m shell -a 'ls /application/'
      109  ansible-doc -s script
      110  ls
      111  ansible ali -m copy -a 'src=/application/xqd/10.txt dest=/application/10.txt'
      112  ansible ali -m shell -a 'ls /application/'
      113  ansible ali -m copy -a 'src=/application/xqd/11.sh dest=/application/11.sh'
      114  ansible ali -m shell -a 'ls -l /application/'
      115  ls
      116  ansible ali -m copy -a 'src=/application/xqd/8.sh dest=/application/8.sh mode=755'
      117  ansible ali -m shell -a 'ls -l /application/'
      118  ls
      119  ansible ali -m copy -a 'src=/application/xqd/9.sh dest=/application/9.sh mode=755 owner=alex'
      120  ansible ali -m shell -a 'ls -l /application/'
      121  ansible ali -m copy -a 'src=/etc/init.d dest=/application/ mode=755 owner=alex'
      122  ansible ali -m shell -a 'ls -l /application/'
      123  ansible ali -m shell -a 'ls -l /application/init.d'
      124  ansible ali -m copy -a 'src=/etc/init.d/ dest=/application/ mode=755 owner=alex'
      125  ansible ali -m copy -a 'content=大弦嘈嘈如急雨,小弦切切如私语 dest=/application/b.txt'
      126  ansible ali -m shell -a 'ls -l /application/'
      127  ansible ali -m copy -a 'content="大弦嘈嘈如急雨,小弦切切如私语
    " dest=/application/b.txt'
      128  ls
      129  cat a.txt 
      130  vim a.txt 
      131  ansible ali -m copy -a 'src=/application/xqd/a.txt dest=/application/a.txt'
      132  ls
      133  vim a.txt 
      134  ansible ali -m copy -a 'src=/application/xqd/a.txt dest=/application/a.txt'
      135  ansible ali -m shell -a 'mkdir lzmly'
      136  ll
      137  ln a.sh c.sh
      138  ll
      139  ln -s a.sh d.sh
      140  ll
      141  cp a.sh e.sh
      142  ll
      143  vim a.sh 
      144  cat c.sh
      145  cat d.sh
      146  cat e.sh
      147  ansible ali -m file -a 'path=/lzlmy2 state=directory'
      148  ansible ali -m shell  -a 'ls /'
      149  ansible ali -m file -a 'path=/root/aaa state=touch'
      150  ansible ali -m shell  -a 'ls'
      151  ansible ali -m file -a 'path=/application src=/etc/fstab  state=link'
      152  ansible ali -m file -a 'path=/application/f src=/etc/fstab  state=link'
      153  ansible ali -m file -a 'path=/root/lzmly  state=absent'
      154  ansible-doc -s fetch
      155  ansible ali -m fetch -a 'src=/var/log/messages dest=/tmp'
      156  ll /tmp
      157  ll /tmp |grep 47.114
      158  cd /tmp
      159  ls
      160  tail -1 47.114.150.49
      161  cd 47.114.150.49/
      162  ls
      163  cd var
      164  ls
      165  cd log
      166  ls
      167  tail -1 messages 
      168  clear
      169  ansible-doc -j fetch
      170  cd ..
      171  ls
      172  cd
      173  ansible-doc -l file
      174  ansible-doc -l 
      175  ansible-doc
      176  ansible-doc -l
      177  ansible-doc -l |wc -l
      178  ansible-doc yum
      179  ansible-doc yum -s
      180  ansible-doc -s yum 
      181  ansible ali -m yum -a 'name=nginx'
      182  yum list|grep pip
      183  cat /etc/yum.repos.d/CentOS-Base.repo 
      184  cat /etc/yum.repos.d/epel.repo
      185  yum grouplist
      186  yum groupinstall 
      187  ansible ali -m yum -a 'name=nginx state=absent'
      188  ansible ali -m shell -a 'rpm -q nginx'
      189  ansible ali -m yum -a 'name="@Development Tools"'
      190  ansible-doc -s pip
      191  ansible ali -m pip -a 'name=pymysql'
      192  ansible ali -m yum -a 'name=nginx'
      193  ss -tnlp
      194  systemctl status nginx
      195  systemctl enabled nginx
      196  ansible-doc -s service
      197  yum install nginx
      198  systemctl enabled nginx
      199  ansible-doc -s service
      200  ss -tnlp
      201  systemctl start nginx
      202  ss -tnlp
      203  systemctl enabled ngnix
      204  systemctl enabled nginx
      205  ansible ali -m service -a 'name=nginx state=started'
      206  ansible ali -m service -a 'name=nginx state=stopped'
      207  ansible-doc -s cron
      208  ansible ali -m cron -a "minute=24 job='touch /tmp/xqd.txt' name=touchfile"
      209  crontab -l
      210  ll /tmp
      211  crontab -l
      212  crontab -r
      213  crontab -l
      214  ansible ali -m cron -a 'name=touchfile state=absent'
      215  ansible ali -m cron -a "minute=24 job='touch /tmp/xqd.txt' name=touchfile disabled=yes"
      216  ansible ali -m cron -a 'name=touchfile state=absent'
  • 相关阅读:
    Mac 应用程序中的App在Launchpad中不显示
    oh-my-zsh的安装
    用Lambda 表达式实现Runnable
    用Lambda 表达式实现Runnable
    记录Nacos配置Mysql数据库连接失败解决
    Mac最好用的终端iTerm2安装及配置
    MySQL安装设置密码策略问题
    构建微服务模块流程
    dependencies与dependencyManagement的区别
    winSocket 2 简单的可持续的socket
  • 原文地址:https://www.cnblogs.com/xuqidong/p/13128490.html
Copyright © 2011-2022 走看看