启动elasticsearch

   - name: source env
     shell: source /etc/profile

   - name: make elastic permission
     shell: su - elsearch  -c 'chmod +x  /opt/elastic/bin/*'

   - name: start es
     remote_user: root
     shell: su - elsearch  -c '/opt/elastic/bin/elasticsearch -d'

  

ansible web --become --become-method=su -K -m shell -a "su - elasticsearch -c '/opt/elasticsearch-6.6.2/bin/elasticsearch -d'"

ansible web --become --become-method=su -K -m shell -a 'source /etc/profile && nohup /bin/bash /opt/logstash-6.6.2/bin/logstash &'

ansible web --become --become-method=su -K -m shell -a "su - elasticsearch -c 'nohup /opt/kibana-6.6.2-linux-x86_64/bin/kibana &'"

  

原文地址:https://www.cnblogs.com/divl/p/10832258.html