Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 1, ssh config is being used #585

Open
matejvrba opened this issue May 22, 2024 · 0 comments
Open

Chapter 1, ssh config is being used #585

matejvrba opened this issue May 22, 2024 · 0 comments

Comments

@matejvrba
Copy link

I'm sorry if this was already reported, but on page 6 the book mentions

If you’re not using port 22 for SSH on this server, you will need to add it to the address, like www.example.com:2222, since Ansible defaults to port 22 and won’t get this value from your ssh config file

Which I believe is not true. With this inventory file

[test]
127.0.1.1

and this in ~/.ssh/config

Host 127.*
	port 2222

When I run ansible -i inv test -m ping I get

127.0.1.1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ssh: connect to host 127.0.1.1 port 2222: Connection refused",
    "unreachable": true
}

One thing I noticed is that there is some sort of caching. If i remove the offending lines config from ssh config and use ansible it works as expected. After that if I re-add the two lines to ssh config ansible still uses the old, working port - example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant