salt一键部署elasticsearch
elasticsearch-file: file.managed: - source: salt://elasticsearch/elasticsearch-5.2.1.tar.gz - name: /opt/elasticsearch-5.2.1.tar.gz - user: root - group: root elasticsearch-install: cmd.run: - name: 'cd /opt && tar -xf elasticsearch-5.2.1.tar.gz && ln -s elasticsearch-5.2.1 elasticsearch && chown -R hadoop:hadoop /opt/elasticsearch*' - unless: 'test -d /opt/elasticsearch-5.2.1' - require: - file: elasticsearch-file elasticsearch-rmtgz: file.absent: - name: /opt/elasticsearch-5.2.1.tar.gz - require: - cmd: elasticsearch-install /etc/profile: file.append: - text: - export ELASTICSEARCH_HOME=/opt/elasticsearch - export PATH=$ELASTICSEARCH_HOME/bin:$PATH - require: - file: elasticsearch-rmtgz source-profile: cmd.run: - name: 'source /etc/profile' - require: - file: /etc/profile
s1: ---------- ID: elasticsearch-file Function: file.managed Name: /opt/elasticsearch-5.2.1.tar.gz Result: True Comment: File /opt/elasticsearch-5.2.1.tar.gz updated Started: 10:14:18.401109 Duration: 896.165 ms Changes: ---------- diff: New file mode: 0644 ---------- ID: elasticsearch-install Function: cmd.run Name: cd /opt && tar -xf elasticsearch-5.2.1.tar.gz && ln -s elasticsearch-5.2.1 elasticsearch && chown -R hadoop:hadoop /opt/elasticsearch* Result: True Comment: Command "cd /opt && tar -xf elasticsearch-5.2.1.tar.gz && ln -s elasticsearch-5.2.1 elasticsearch && chown -R hadoop:hadoop /opt/elasticsearch*" run Started: 10:14:19.298867 Duration: 394.837 ms Changes: ---------- pid: 27938 retcode: 0 stderr: stdout: ---------- ID: elasticsearch-rmtgz Function: file.absent Name: /opt/elasticsearch-5.2.1.tar.gz Result: True Comment: Removed file /opt/elasticsearch-5.2.1.tar.gz Started: 10:14:19.694369 Duration: 12.184 ms Changes: ---------- removed: /opt/elasticsearch-5.2.1.tar.gz ---------- ID: /etc/profile Function: file.append Result: True Comment: File /etc/profile is in correct state Started: 10:14:19.706777 Duration: 6.654 ms Changes: ---------- ID: source-profile Function: cmd.run Name: source /etc/profile Result: True Comment: Command "source /etc/profile" run Started: 10:14:19.713673 Duration: 23.206 ms Changes: ---------- pid: 27943 retcode: 0 stderr: stdout: Summary for s1 ------------ Succeeded: 5 (changed=4) Failed: 0 ------------ Total states run: 5 Total run time: 1.333 s