Has anyone installed/run ActiveMQ on IBM i and can help me with this?
Either the process does not run or gives ZipException.
I downloaded ActiveMQ 5.16.2 from ActiveMQ 5.16.2 (Apr 28, 2021) - Unix/Linux/Cygwin bundle
for installing on IBMi V7R3 and followed the official steps for installation mentioned on Version 5 Getting Started - 'Installation Procedure for Unix' section.
This is similar to installing on IBMi as mentioned in - Installing activeMQ on IBM i5 V5R4
On running the command ./bin/activemq start, the process starts but ends without actually running ActiveMq.
It shows below error on the console -
./bin/activemq: 001-0019 Error found searching for command whoami. No such path or directory.
Also the command ./bin/activemq status returns ActiveMQ not running .
When running the command ./bin/activemq console, the process starts but gives the same whoami error and ends with ZipException.
On Windows, I have been able to install and run successfully.
Has anyone installed ActiveMQ on IBMi and can help me with this?
You are missing the command
whoami
This is not a shell built-in, so you would need to add that package to your installation.
h/t to #nfgl for the pointer to the IBM OSS rpm repo. If you inspect their src.rpm, you'll see they patch the activemq script. Worth reviewing
SRC RPM calls for this dependency: coreutils-gnu
IBM iSeries Patch of bin/activemq:
$ more activemq-activemq.patch
--- a/bin/activemq 2020-03-30 18:50:50.000000000 +0000
+++ b/bin/activemq 2020-03-30 18:57:03.000000000 +0000
## -336,10 +336,14 ##
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
$ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS >> $ACTIVEMQ_OUT 2>&1 &
- RET=\"\$?\"; APID=\"\$!\";
- echo \$APID > "${PIDFILE}";
- echo \"INFO: pidfile created : '${PIDFILE}' (pid '\$APID')\";exit \$RET" $DOIT_POSTFIX
- RET="$?"
+ exit \"\$?\"" $DOIT_POSTFIX
+ RET="$?"
+ sleep 5
+ OS400_PID=`ps | grep -iE 'java|jFromPASE|jvmStartPase|qp0zspwp' | grep -v '\spgm-' | grep -vE '^\s+1\s' | tail -n 1 | awk '{print $1}'`
+ rm -f $PIDFILE
+ qsh -c "/usr/bin/touch -C 1208 $PIDFILE"
+ echo $OS400_PID > $PIDFILE
+ echo "INFO: pidfile created : '$PIDFILE' (pid '$OS400_PID')"
elif [ -n "$TASK_TODO" ] && [ "$TASK_TODO" = "stop" ];then
SPID="`cat "${PIDFILE}"`"
$EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \
## -384,7 +388,7 ##
return 2
fi
ACTIVEMQ_PID="`cat ${ACTIVEMQ_PIDFILE}`"
- RET="`ps -p "${ACTIVEMQ_PID}"|grep java`"
+ RET=`/QOpenSys/usr/bin/ps -p ${ACTIVEMQ_PID}|grep -iE 'java|jFromPASE|jvmStartPase'`
if [ -n "$RET" ];then
return 0;
else
## -403,7 +407,7 ##
return 2
fi
THEPID=`cat ${PID_STOP}`
- RET=`ps -p $THEPID|grep java`
+ RET=`/QOpenSys/usr/bin/ps -p ${ACTIVEMQ_PID}|grep -iE 'java|jFromPASE|jvmStartPase'`
if [ -n "$RET" ];then
return 0;
else
For my SolydXK repository I'd like to add some packages available in Debian stretch-backports.
I've successfully setup the conf/distributions, conf/updates and FilterList files and the following command runs successfully when logged in to the server:
reprepro -b /path_to_repository_basedir update
When adding files to the repository I correctly have to fill in my gpg passphrase to sign the files. During the session I only have to do that once.
Now I've tried to make the signing unattended by creating this script that's called from my .bash_profile:
#!/bin/sh
OURKEY=ABCDEFGH
PASSPHRASE=my_passphrase
PIDOF=`pidof gpg-agent`
RETVAL=$?
# Decide wether to start gpg-agent daemon.
if [ "$RETVAL" -eq 1 ]; then
echo "Starting gpg-agent daemon."
eval `gpg-agent --allow-preset-passphrase --allow-mark-trusted --default-cache-ttl-ssh 4294967295 --default-cache-ttl 4294967295 --max-cache-ttl 4294967295 --daemon --enable-ssh-support --write-env-file "${HOME}/.gpg-agent-info"`
else
echo "Daemon gpg-agent already running."
fi
if [ -f "${HOME}/.gpg-agent-info" ]; then
. "${HOME}/.gpg-agent-info"
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
# Create necessary symbolic link
cp -fs `echo $GPG_AGENT_INFO | cut -d':' -f 1` "${HOME}/.gnupg/"
fi
# Default trust our own key
rm ~/.gnupg/trustlist.txt
for FP in $(gpg2 --fingerprint --with-colons --fingerprint $OURKEY | grep ^fpr | cut -d':' -f 10); do
echo "$FP S" >> ~/.gnupg/trustlist.txt
echo $PASSPHRASE | /usr/lib/gnupg2/gpg-preset-passphrase --preset $FP
done
# Set GPG TTY
export GPG_TTY=$(tty)
I checked the fingerprints (a.k.a. keygrip, but this version of gpgsm does not know the --with-keygrip option) and all seems to be alright. However, when a cron job runs the above update command, an error message states that the passphrase is incorrect.
The server runs on Debian old-squeeze (I know, I have to do something about that, but that's another problem) and that might be a big problem. Here's some version info:
cat /etc/debian_version
6.0.10
uname -r
3.14.52-vs2.3.6.15-1
gpg (GnuPG) 1.4.10
gpg (GnuPG) 2.0.14
gpgsm (GnuPG) 2.0.14
gpg-agent (GnuPG) 2.0.14
So, is there somebody here who has some experience with unattended signing of packages with gpg-agent and can explain to me what I'm doing wrong?
There're slight discrepancies in the documentation Docker deployment for PaddlePaddle as compared to the documentation to manually install PaddlePaddle from source.
The documentation from the Docker deployment states after pulling the container from Docker Hub:
docker pull paddledev/paddle
the environment variables should be set and included in the docker run, i.e.:
export CUDA_SO="$(\ls /usr/lib64/libcuda* | xargs -I{} echo '-v {}:{}') $(\ls /usr/lib64/libnvidia* | xargs -I{} echo '-v {}:{}')"
export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}')
docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest
The export commands seem to be looking for libcuda* and libnvidia* in /usr/lib64/ but in the documentation from source compilation, the location of lib64/ should be in /usr/local/cuda/lib64.
Regardless, the location of lib64/ can be found with:
cat /etc/ld.so.conf.d/cuda.conf
Additionally, the export command is looking for libnvidia* which doesn't seem exist anywhere in /usr/local/cuda/, except for libnvidia-ml.so:
/usr/local/cuda$ find . -name 'libnvidia*'
./lib64/stubs/libnvidia-ml.so
I suppose the correct files the CUDA_SO is looking for are
/usr/local/cuda/lib64/libcudart.so.8.0
/usr/local/cuda/lib64/libcudart.so.7.5
But is that right? What is the environmental variable(s) for CUDA_SO to deploy PaddlePaddle with GPU support?
Even after setting the libcudart* variable, the docker container doesn't seem to find the GPU driver, i.e.:
user0#server1:~/dockdock$ echo CUDA_SO="$(\ls $CUDA_CONFILE/libcuda* | xargs -I{} echo '-v {}:{}')"
CUDA_SO=-v /usr/local/cuda/lib64/libcudadevrt.a:/usr/local/cuda/lib64/libcudadevrt.a
-v /usr/local/cuda/lib64/libcudart.so:/usr/local/cuda/lib64/libcudart.so
-v /usr/local/cuda/lib64/libcudart.so.8.0:/usr/local/cuda/lib64/libcudart.so.8.0
-v /usr/local/cuda/lib64/libcudart.so.8.0.44:/usr/local/cuda/lib64/libcudart.so.8.0.44
-v /usr/local/cuda/lib64/libcudart_static.a:/usr/local/cuda/lib64/libcudart_static.a
user0# server1:~/dockdock$ export CUDA_SO="$(\ls $CUDA_CONFILE/libcuda* | xargs -I{} echo '-v {}:{}')"
user0# server1:~/dockdock$ export DEVICES=$(\ls /dev/nvidia* | xargs -I{} echo '--device {}:{}')
user0# server1:~/dockdock$ docker run ${CUDA_SO} ${DEVICES} -it paddledev/paddle:gpu-latest
root#bd25dfd4f824:/# git clone https://github.com/baidu/Paddle paddle
Cloning into 'paddle'...
remote: Counting objects: 26626, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 26626 (delta 3), reused 0 (delta 0), pack-reused 26603
Receiving objects: 100% (26626/26626), 25.41 MiB | 4.02 MiB/s, done.
Resolving deltas: 100% (18786/18786), done.
Checking connectivity... done.
root#bd25dfd4f824:/# cd paddle/demo/quick_start/
root#bd25dfd4f824:/paddle/demo/quick_start# sed -i 's|--use_gpu=false|--use_gpu=true|g' train.sh
root#bd25dfd4f824:/paddle/demo/quick_start# bash train.sh
I0410 09:25:37.300365 48 Util.cpp:155] commandline: /usr/local/bin/../opt/paddle/bin/paddle_trainer --config=trainer_config.lr.py --save_dir=./output --trainer_count=4 --log_period=100 --num_passes=15 --use_gpu=true --show_parameter_stats_period=100 --test_all_data_in_one_period=1
F0410 09:25:37.300940 48 hl_cuda_device.cc:526] Check failed: cudaSuccess == cudaStat (0 vs. 35) Cuda Error: CUDA driver version is insufficient for CUDA runtime version
*** Check failure stack trace: ***
# 0x7efc20557daa (unknown)
# 0x7efc20557ce4 (unknown)
# 0x7efc205576e6 (unknown)
# 0x7efc2055a687 (unknown)
# 0x895560 hl_specify_devices_start()
# 0x89576d hl_start()
# 0x80f402 paddle::initMain()
# 0x52ac5b main
# 0x7efc1f763f45 (unknown)
# 0x540c05 (unknown)
# (nil) (unknown)
/usr/local/bin/paddle: line 109: 48 Aborted (core dumped) ${DEBUGGER} $MYDIR/../opt/paddle/bin/paddle_trainer ${#:2}
[1]: http://www.paddlepaddle.org/doc/build/docker_install.html
[2]: http://paddlepaddle.org/doc/build/build_from_source.html
How to deploy a PaddlePaddle Docker container with GPU support?
Also, in Chinese: https://github.com/PaddlePaddle/Paddle/issues/1764
Please refer to http://www.paddlepaddle.org/develop/doc/getstarted/build_and_install/docker_install_en.html
The recommended way is using nvidia-docker.
Please install nvidia-docker first following this tutorial.
Now you can run a GPU image:
docker pull paddlepaddle/paddle
nvidia-docker run -it --rm paddlepaddle/paddle:0.10.0rc2-gpu /bin/bash
I have a problem with docker-machine and openstack
running this command
docker-machine --debug create -d openstack --openstack-username admin --openstack-password admin --openstack-tenant-name admin --openstack-auth-url http://163.172.5.197:5000/v2.0 --openstack-flavor-id bea5cb42-c0b3-46fd-96a6-2f4c5d4448c2 --openstack-image-id 871a5ddf-a888-4b45-9201-78da07e6cdcb testmachine
gives me the output as follow
Docker Machine Version: 0.6.0, build e27fb87
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:46658
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver openstack
Plugin server listening at address 127.0.0.1:44014
() Calling .GetVersion
Using API Version 1
() Calling .SetConfigRaw
() Calling .GetMachineName
(testmachine) Calling .GetMachineName
(testmachine) Calling .DriverName
(testmachine) Calling .GetCreateFlags
(testmachine) Calling .SetConfigFromFlags
Running pre-create checks...
(testmachine) Calling .PreCreateCheck
(testmachine) Calling .GetConfigRaw
Creating machine...
(testmachine) Calling .Create
(testmachine) DBG | Authenticating... map[Insecure:false DomainID: DomainName: Username:admin TenantName:admin TenantID: AuthUrl:http://163.172.5.197:5000/v2.0]
(testmachine) DBG | Found tenant id using its name map[Name:admin ID:3247c97c6abf4c07aee78043a1caa261]
(testmachine) DBG | Creating Key Pair... map[Name:testmachine-5f792f35e57c8749b3a39074cc230831a6902250f91c7f76fb30299ad00713be]
(testmachine) Creating machine...
(testmachine) DBG | Creating OpenStack instance... map[FlavorId:bea5cb42-c0b3-46fd-96a6-2f4c5d4448c2 ImageId:871a5ddf-a888-4b45-9201-78da07e6cdcb]
(testmachine) DBG | Waiting for the OpenStack instance to be ACTIVE... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | Looking for the IP address... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) Calling .GetConfigRaw
(testmachine) Calling .DriverName
(testmachine) Calling .DriverName
Waiting for machine to be running, this may take a few minutes...
(testmachine) Calling .GetState
(testmachine) DBG | IP address found map[IP:10.0.0.2 MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | Get status for OpenStack instance... map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a]
(testmachine) DBG | State for OpenStack instance map[MachineId:3184e817-07d2-47af-9cb7-06634cebcc0a State:ACTIVE]
Detecting operating system of created instance...
Waiting for SSH to be available...
Getting to WaitForSSH function...
(testmachine) Calling .GetSSHHostname
(testmachine) Calling .GetSSHPort
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none root#10.0.0.2 -o IdentitiesOnly=yes -i /home/martin/.docker/machine/machines/testmachine/id_rsa -p 22] /usr/bin/ssh}
About to run SSH command:
exit 0
SSH cmd err, output: exit status 255:
Error getting ssh command 'exit 0' : Something went wrong running an SSH command!
command : exit 0
err : exit status 255
output :
Getting to WaitForSSH function...
(testmachine) Calling .GetSSHHostname
(testmachine) Calling .GetSSHPort
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHKeyPath
(testmachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none root#10.0.0.2 -o IdentitiesOnly=yes -i /home/martin/.docker/machine/machines/testmachine/id_rsa -p 22] /usr/bin/ssh}
About to run SSH command:
exit 0
then when i am trying to run docker-machine ls
testmachine - openstack Running tcp://10.0.0.2:2376 Unknown Unable to query docker version: Unable to read TLS config: open /home/martin/.docker/machine/machines/testmachine/server.pem: no such file or directory
Logs in openstack for machine :
open-vm-tools: not starting as this is not a VMware VM
landscape-client is not configured, please run landscape-config.
* Stopping CPU interrupts balancing daemon[74G[ OK ]
* Starting automatic crash report generation[74G[ OK ]
* Restoring resolver state... [80G [74G[ OK ]
* Stopping System V runlevel compatibility[74G[ OK ]
Generating locales...
en_US.UTF-8... up-to-date
Generation complete.
Cloud-init v. 0.7.5 running 'modules:final' at Tue, 03 May 2016 11:45:45 +0000. Up 10.17 seconds.
ci-info: +++++Authorized keys from /home/ubuntu/.ssh/authorized_keys for user ubuntu++++++
ci-info: +---------+-------------------------------------------------+---------+---------+
ci-info: | Keytype | Fingerprint (md5) | Options | Comment |
ci-info: +---------+-------------------------------------------------+---------+---------+
ci-info: | ssh-rsa | fe:05:1e:f2:04:c4:df:4f:53:f2:4f:c3:ba:ac:10:51 | - | - |
ci-info: +---------+-------------------------------------------------+---------+---------+
ec2:
ec2: #############################################################
ec2: -----BEGIN SSH HOST KEY FINGERPRINTS-----
ec2: 1024 46:c0:bb:6c:65:04:13:fc:ab:2b:51:4f:1c:1e:75:dc root#testmachine (DSA)
ec2: 256 81:cd:f3:dd:66:7a:ca:4e:95:78:43:a7:dc:29:ad:fd root#testmachine (ECDSA)
ec2: 256 f5:d9:c7:59:92:af:fc:b7:56:42:ca:1e:f7:bb:5b:89 root#testmachine (ED25519)
ec2: 2048 6e:2d:1b:52:84:3f:28:04:95:41:81:15:af:61:e5:96 root#testmachine (RSA)
ec2: -----END SSH HOST KEY FINGERPRINTS-----
ec2: #############################################################
-----BEGIN SSH HOST KEY KEYS-----
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFfEl02HEegH7vohFTTS1bxA7LaIua/f+j0Uvi1u3j8fyTfzuVzqHl73QaBtE6uJ7EuTaoDhNCeeyWF+sLqMulI= root#testmachine
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGmcm55oSkblJ//oUcNQMqB2oO7BG2vXA0fhHEhlOQba root#testmachine
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDc3VqU3V9of956GD0DhCc5YEbkBzOgOazVRiFxx31I2wW3Z5vnW+BgZLoRhB8Zj2Tbn70l7cPKcN3/orklZldhoSK4u0+0buqhArqqp+/JBmR5AXn6hlcRvpLU+KM1qFovJuwwuttelaB0vS9YzwCLiCODLp9A4mvOCFiCbxOpvz7Bt5mMlvBnZnN3iWNiAn4aMjCrxwuUGruTXnO9ffRMs6GC4WVazUD42cD34g4FUlPf1Dqlinau5bRQrNbrU8vhiXE+DhxQO4WMMulsYoKfVDxhRrokwNpS9rB1HhHd+VOh7iTwkEwszCPtsYSrXYVng8JZzHBdq94SrOU3D58Z root#testmachine
-----END SSH HOST KEY KEYS-----
Cloud-init v. 0.7.5 finished at Tue, 03 May 2016 11:45:46 +0000. Datasource DataSourceConfigDriveNet [net,ver=2][source=/dev/sr0]. Up 10.27 seconds
Ubuntu 14.04.4 LTS testmachine ttyS0
testmachine login:
I precise that ports 22, 80 and 2376 are open on the machine on OpenStack.
thanks, if someone could help me, it would be nice
TL;DR Try adding the following options:
--openstack-net-id or --openstack-net-name
--openstack-floatingip-pool
--openstack-sec-groups
Original answer:
I get the very same thing when running docker-machine 0.6.0 with the openstack driver. But v0.7.0 (build a650a40) works just fine for me. I'm running a centos image not ubuntu, but otherwise the same. Sorry, I've not used docker-machine in a while but try just grabbing the latest release and see if that helps.
Update:
Just double-checked what I ran above, I actually configured this with environment variables, specifying a few things additional to yours above. Specifically though, in addition to my openstack RC file, I set:
export OS_SSH_USER=centos
export OS_IMAGE_ID=c31637b9-455a-4849-8f46-2af1715f9dee
export OS_FLAVOR_NAME=m1.small
export OS_FLOATINGIP_POOL=INTERNAL-NETWORK
export OS_SECURITY_GROUPS=default
export OS_NETWORK_ID=b32e2700-8eac-4b7c-b9a8-16b6403927a2
and then ran:
docker-machine create -d=openstack testmachine
Purpose
I want ansible to provision virtual box vm's on my windows 8 machine [via Vagrant]. Everything needs to run locally and since Ansible doesn't run on Windows, I bootstrap a debian vm with ansible as the control machine. This code served as an example.
After struggling with the system I got it somewhat working, but not completely (although ansible doesn't tell me).
Question
What configuration is required for a multi-machine setup using ansible [in a vm], vagrant and virtualbox [on windows host] if we want:
ssh acces from the host machine to the ansible-vm as well as all the slaves
ssh acces from the ansible-vm to all the slaves
being able to shield the multi-machine network from the host's network, if possible
Problem
Running ansible -m ping -all -i path-to-hosts yields ssh errors. It seems ansible tries to reach the machines named web1 and db1, but can't find such hosts.
ESTABLISH CONNECTION FOR USER: vagrant
REMOTE_MODULE ping
ESTABLISH CONNECTION FOR USER: vagrant
REMOTE_MODULE ping
EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'web1', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1398362619.41-142470238612762 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1398362619.41-142470238612762 && echo $HOME/.ansible/tmp/ansible-tmp-1398362619.41-142470238612762'"]
EXEC previous known host file not found for web1
EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'db1', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1398362619.41-4982781019922 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1398362619.41-4982781019922 && echo $HOME/.ansible/tmp/ansible-tmp-1398362619.41-4982781019922'"]
EXEC previous known host file not found for db1
web1 | FAILED => SSH encountered an unknown error. The output was:
OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/vagrant/.ansible/cp/ansible-ssh-web1-22-vagrant" does not exist
debug2: ssh_connect: needpriv 0
ssh: Could not resolve hostname web1: Name or service not known
db1 | FAILED => SSH encountered an unknown error. The output was:
OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/vagrant/.ansible/cp/ansible-ssh-db1-22-vagrant" does not exist
debug2: ssh_connect: needpriv 0
ssh: Could not resolve hostname db1: Name or service not known
Code
The following code tries to provision
1. ansible-master: the control machine running ansible
1. db1: a database server
1. web1: a web server
Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "wheezy64"
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box"
config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=777','fmode=666']
config.vm.network :public_network
config.vm.provider "virtualbox" do |v|
v.customize [
"modifyvm", :id,
"--groups", "/Vagrant/Ansible",
# "--natdnshostresolver1", "on"
]
end
config.vm.define :ansiblemaster do |ansiblemaster|
# ansiblemaster.vm.network :private_network, ip: "192.168.111.101"
ansiblemaster.vm.hostname = "ansiblemaster"
# ansiblemaster.vm.network :forwarded_port, guest: 80, host: 8080
ansiblemaster.ssh.forward_agent = true
ansiblemaster.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", 512]
vb.customize ["modifyvm", :id, "--name", "ansible-master"]
vb.name = "ansiblemaster"
end
ansiblemaster.vm.provision :shell, :inline =>
"if [[ ! -f /apt-get-run ]]; then sudo apt-get update && sudo touch /apt-get-run; fi"
ansiblemaster.vm.provision :shell do |sh|
sh.path = "provision.sh"
sh.args = "./ansible provisioning/site.yml provisioning/hosts/dev_hosts"
end
end
config.vm.define :web1 do |slave|
slave.vm.hostname = "web1"
# slave.vm.network :private_network, ip: "192.168.111.201"
slave.vm.synced_folder "./src", "/var/www/site", id: "proj-root"
slave.vm.provider :virtualbox do |vb|
vb.name = "web1"
vb.customize ["modifyvm", :id, "--memory", "512"]
end
end
config.vm.define :db1 do |slave|
slave.vm.hostname = "db1"
#slave.vm.network :private_network, ip: "192.168.111.202"
slave.vm.provider :virtualbox do |vb|
vb.name = "db1"
vb.customize ["modifyvm", :id, "--memory", "512"]
end
end
end
Provision.sh
#!/bin/bash
ANSIBLE_DIR=$1
ANSIBLE_PLAYBOOK=$2
ANSIBLE_HOSTS=$3
TEMP_HOSTS="/tmp/ansible_hosts"
if [ ! -f /vagrant/$ANSIBLE_PLAYBOOK ]; then
echo "Cannot find Ansible playbook"
exit 1
fi
if [ ! -f /vagrant/$ANSIBLE_HOSTS ]; then
echo "Cannot find Ansible hosts"
exit 2
fi
if [ ! -d $ANSIBLE_DIR ]; then
echo "Updating apt cache"
apt-get update
echo "Installing Ansible dependencies and Git"
apt-get install -y git python-yaml python-paramiko python-jinja2
echo "Cloning Ansible"
git clone git://github.com/ansible/ansible.git ${ANSIBLE_DIR}
fi
cd ${ANSIBLE_DIR}
cp /vagrant/${ANSIBLE_HOSTS} ${TEMP_HOSTS} && chmod -x ${TEMP_HOSTS}
echo "Running Ansible"
echo "dir is nu: " $(pwd)
source hacking/env-setup
echo "source ${ANSIBLE_DIR}/hacking/env-setup" >> /home/vagrant/.bashrc
ansible-playbook /vagrant/${ANSIBLE_PLAYBOOK} --inventory-file=${TEMP_HOSTS} --connection=local
rm ${TEMP_HOSTS}
provsioning/hosts/dev_hosts
[webservers]
web1
[dbservers]
db1
To answer my own question: the problem was resolved by upgrading ansible and importing the ssh keys of the other machines in Provision.sh.
# fix permissions on private key file
chmod 600 /home/vagrant/.ssh/id_rsa
# add web/database hosts to known_hosts (IP is defined in Vagrantfile)
ssh-keyscan -H 192.168.51.4 >> /home/vagrant/.ssh/known_hosts
ssh-keyscan -H 192.168.52.4 >> /home/vagrant/.ssh/known_hosts
chown vagrant:vagrant /home/vagrant/.ssh/known_hosts
# reload ssh in order to load the known hosts
/etc/init.d/ssh reload
Thats a really long question problem.
Ansible cant figure out the dns "ssh: Could not resolve hostname web1: Name or service not known"
Option 1
I like to simplify i boot my vagrant vm with static ip vm.network :private_network, ip: "xxx.xxx.xxx.xxx" and i edit my ansible host file
provsioning/hosts/dev_hosts
[webservers]
web1 ansible_ssh_host=xxx.xxx.xxx.xxx
[dbservers]
db1 ansible_ssh_host=xxx.xxx.xxx.yyy
Option 2
Use DNS or hostsfile
Hope that helps
Using "normal" Ansible modules to manage Windows boxes isn´t possible. Instead you have to use one of the windows modules. That´s the same for ping. It tries to connect via SSH to the Windows box, which doesn´t work.
Like skinnedknuckles already said, Ansible uses native Powershell remoting (and WinRM) instead of SSH to communicate with a Windows machine. So the win_ping module is the right way to do a ping with Ansible onto a Windows box:
ansible -m win_ping -all -i path-to-hosts
I assume you prepared your Windows 8 VM, like the docs are describing!?! If not, there´s this blog post explaining how to do all the steps incl. Vagrant setup with winrm connectivity in quite compact form.