###前提・実現したいこと
vagrant inlineを使ってvm構築後にコマンド実行させたい
###発生している問題・エラーメッセージ
vagrant upした際に以下のエラーでファイル実行できません。
vagrant up を実行したディレクトリに
記載のとおりのディレクトリ、ファイルが配置されています。(test/exapmle.sh)
書き方が間違えているのでしょうか。。。
どうすればいいかご教授お願いいたします。
※vagrant実行するユーザが多数いるため
test/example.shの位置は変えずに保存したいと考えています
PS C:\Users\XXXXXXXXXX\vagrant\centos7-3> vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'centos-7.3.1611-x86_64-base'... ==> default: Matching MAC address for NAT networking... ==> default: Setting the name of the VM: centos7-3_default_1513780440989_92272 ==> default: Fixed port collision for 22 => 2222. Now on port 2200. ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 22 (guest) => 2200 (host) (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2200 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Remote connection disconnect. Retrying... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Mounting shared folders... default: /vagrant => C:/Users/XXXXXXXXXX/vagrant/centos7-3 ==> default: Running provisioner: shell... default: Running: inline script ==> default: /tmp/vagrant-shell: line 1: test/sample.sh: No such file or directory The SSH command responded with a non-zero exit status. Vagrant assumes that this means the command failed. The output for this command should be in the log above. Please read the output to determine what went wrong.
###該当のソースコード
VagrantFile
Vagrant.configure(2) do |config| config.vm.box = "centos-7.3.1611-x86_64-base" config.vm.network "private_network", ip: "XXX.XXX.XXX.XXX" config.vm.provision "shell", inline: "test/sample.sh" end
test/sample.sh
yum -y install httpd
###補足情報(言語/FW/ツール等のバージョンなど)
Vagrant 1.9.3
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。