加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

使用Vagrant触发器在主机上执行bash脚本

发布时间:2020-12-15 17:00:00 所属栏目:安全 来源:网络整理
导读:我使用Vagrant来启动我的测试环境.可悲的是,我必须在旋转我的Vagrant盒子之前检索信息(密码).到目前为止,我使用Vagrant-Triggers来执行此操作并具有多个运行“执行某些操作”命令. IS [:up,:provision].each do |cmd| config.trigger.before cmd,stdout: tru
我使用Vagrant来启动我的测试环境.可悲的是,我必须在旋转我的Vagrant盒子之前检索信息(密码).到目前为止,我使用Vagrant-Triggers来执行此操作并具有多个运行“执行某些操作”命令.

IS

[:up,:provision].each do |cmd|
    config.trigger.before cmd,stdout: true do
      run "rm -rf #{cookbooks_path}"
      run "mkdir -p #{cookbooks_path}"
      run "touch fileX"
      run "touch fileY"
      run "touch fileZ"
    end
end

How can I move all my commands to one batch file which I then only
include?

应该

[:up,stdout: true do
      include_script "Vagrant_trigger_before.sh"
    end
end

谢谢您的帮助!

您可以使用运行说明直接运行脚本
[:up,stdout: true do
      run "Vagrant_trigger_before.sh"
    end
end

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读