geerlingguy / geerlingguy/ansible-for-devops
Failed to connect to the host via ssh: vagrant@192.168.60.5: Permission denied (publickey,password).",
- Dominant language
- Python
- Stars
- 9.9k
- Forks
- 3.8k
- PR merge metrics
- No merged PRs in 30d
Description
OS: MacosX
```
ansible -m ping all
192.168.60.4 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: vagrant@192.168.60.4: Permission denied (publickey,password).",
"unreachable": true
}
192.168.60.5 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: vagrant@192.168.60.5: Permission denied (publickey,password).",
"unreachable": true
}
192.168.60.6 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: vagrant@192.168.60.6: Permission denied (publickey,password).",
"unreachable": true
}
```
```
cat /etc/ansible/hosts
# Lines beginning with a # are comments and are only included for
# illustration. These comments are overkill for most inventory files.
# Application servers
[app]
192.168.60.4
192.168.60.5
# Database server
[db]
192.168.60.6
# Group 'multi' with all servers
[multi:children]
app
db
# Variables that will ve applied to all servers
[multi:vars]
ansible_ssh_user=vagrant
ansbile_ssh_private_key_file=/Users/florin/.vagrant.d/insecure_private_key
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
```
```
$ vagrant ssh-config
Host app1
HostName 127.0.0.1
User vagrant
Port 2200
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/florin/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Host app2
HostName 127.0.0.1
User vagrant
Port 2201
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/florin/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Host db
HostName 127.0.0.1
User vagrant
Port 2202
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/florin/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
```
```
~/three_servers cat Vagrantfile
# _*_ mode: ruby _*_
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# General Vagrant VM configuration
config.vm.box = "geerlingguy/centos7"
config.ssh.insert_key = false
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :virtualbox do |v|
v.memory = 256
v.linked_clone = true
end
# Application server 1.
config.vm.define "app1" do |app|
app.vm.hostname = "orc-app1.test"
app.vm.network :private_network, ip: "192.168.60.4"
end
# Application server 2.
config.vm.define "app2" do |app|
app.vm.hostname = "orc-app2.test"
app.vm.network :private_network, ip: "192.168.60.5"
end
# Database server.
config.vm.define "db" do |db|
db.vm.hostname = "orc-db.test"
db.vm.network :private_network, ip: "192.168.60.6"
end
end
```
```
vagrant status
Current machine states:
app1 running (virtualbox)
app2 running (virtualbox)
db running (virtualbox)
This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing `ansible -m ping all` with the `/etc/ansible/hosts` inventory, then compare its connection settings with `vagrant ssh-config` and the `Vagrantfile`. Check whether the reported configuration is still supported by the repository's examples; done means identifying a reproducible repository issue and documenting the verified correction or closing it as environment-specific.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible, ruby
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100