salt-stack安装jdk 1.8

网友投稿 762 2022-10-13

salt-stack安装jdk 1.8

salt-stack安装jdk 1.8

1.配置master配置文件

[root@master jdk]# cat /etc/salt/master | grep -v "#" | grep -10 "file_roots"file_roots: base: - /soft/salt dev: - /soft/salt/dev/services - /soft/salt/dev/states prod: - /soft/salt/prod/services - /soft/salt/prod/states

2.编写jdk的sls文件,上传jdk介质​

[root@master state]# pwd/soft/salt/state[root@master state]# tree.├── jdk│ ├── files│ │ └── jdk-8u202-linux-x64.tar.gz│ └── init.sls

3.查看init.sls文件

[root@master state]# cat jdk/init.sls jdk-install: file.managed: - name: /usr/local/src/jdk-8u202-linux-x64.tar.gz - source: salt://state/jdk/files/jdk-8u202-linux-x64.tar.gz - user: root - group: root - mode: 755 cmd.run: - name: cd /usr/local/src && tar xf jdk-8u202-linux-x64.tar.gz && mv jdk1.8.0_202 /usr/local/jdk && chown -R root:root /usr/local/jdk - unless: test -d /usr/local/jdk - require: - file: jdk-installjdk-config: file.append: - name: /etc/profile - text: - export JAVA_HOME=/usr/local/jdk - export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar - export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

4.在minion01执行命令安装jdk。使用state.sls方式​

[root@master state]# salt minion01 state.sls state.jdkminion01:---------- ID: jdk-install Function: file.managed Name: /usr/local/src/jdk-8u202-linux-x64.tar.gz Result: True Comment: File /usr/local/src/jdk-8u202-linux-x64.tar.gz updated Started: 17:23:13.127525 Duration: 12368.83 ms Changes: ---------- diff: New file mode: 0755---------- ID: jdk-install Function: cmd.run Name: cd /usr/local/src && tar xf jdk-8u202-linux-x64.tar.gz && mv jdk1.8.0_202 /usr/local/jdk && chown -R root:root /usr/local/jdk Result: True Comment: Command "cd /usr/local/src && tar xf jdk-8u202-linux-x64.tar.gz && mv jdk1.8.0_202 /usr/local/jdk && chown -R root:root /usr/local/jdk" run Started: 17:23:25.498202 Duration: 11240.566 ms Changes: ---------- pid: 30568 retcode: 0 stderr: stdout:---------- ID: jdk-config Function: file.append Name: /etc/profile Result: True Comment: File /etc/profile is in correct state Started: 17:23:36.739389 Duration: 13.821 ms Changes: Summary for minion01------------Succeeded: 3 (changed=2)Failed: 0------------Total states run: 3Total run time: 23.623 s

5.在minion01节点查看​

[root@minion01 ~]# java -versionjava version "1.8.0_202"Java(TM) SE Runtime Environment (build 1.8.0_202-b08)Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

LINUX

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:ChatApp一个使用Django构建的小型点对点消息中心应用程序
下一篇:jikeCountDown 一个简单的微信小程序,用来查看即刻停服了多久
相关文章

 发表评论

暂时没有评论,来抢沙发吧~