ansible操作随记(一)
#shell模块 执行shell指令
ansible all -m shell -e "timedatectl show"
ansible web -m shell -a "date"
ansible web -m shell -a "echo '* soft nofile 1048576' >> /etc/security/limits.conf" -b --become-method su --become-user root
ansible web -m shell -a "echo '* hard nofile 1048576' >> /etc/security/limits.conf" -b --become-method su --become-user root
ansible web -m shell -a "tail /etc/security/limits.conf"
ansible web -m shell -a "ulimit -a"
ansible hadoop -m shell -a "ls /etc/ambari-agent/conf/ambari-agent.ini"
ansible hadoop -m shell -a "ambari-agent status"
ansible web -m shell -a "yum install -y java-11-openjdk java-11-openjdk-devel" -b --become-method su --become-user root
ansible web -m shell -a "java -version"
ansible web -m shell -a "jps -ml"
#copy模块,远程拷贝
ansible gxtest-117 -m copy -a "src=/home/test/packages/bigtop-3.2.0.zip dest=/data/" -b --become-method su --become-user root
ansible gxtest-117 -m copy -a "src=/home/test/packages/ambari-2.8.0.zip dest=/data/" -b --become-method su --become-user root
ansible gxtest-117 -m copy -a "src=/home/test/packages/mysql-connector-java-8.0.28.jar dest=/data/" -b --become-method su --become-user root
ansible gxtest-117 -m copy -a "src=/home/test/packages/mysql-8.0.36-1.el8.x86_64.rpm-bundle.tar dest=/data/" -b --become-method su --become-user root
ansible test -m copy -a "src=/data/xxx/conf/application.xml dest=/data/xxx/conf/"
ansible sdtp -m copy -a "src=/data/sxxxhdfs dest=/data/"
#script模块,执行脚本内容。
ansible test -m script -a "start_xxx.sh"