When running the command to deploy, I cannot connect via SSH to the server. I guess it’s because Ansible is probably using a default port of 22, however, knowing that it should be fairly simple to change the port and run the command in my terminal. I found a similar topic on this forum on how to change the port in hosts/production, so I did as follow :
This didn’t change anything. In fact, even in my error it doesn’t say I’m trying to connect to the server with the port of 33654, it says the exact same thing as before. I am guessing that Ansible is not taking my port number in consideration.
My ansible version is 220.127.116.11, any help would be greatly appreciated!
You say “deploy” but did the connection work in the prior step of provisioning? (see Trellis usage of terms provision vs deploy). If you’re trying to run
server.yml, connection will fail because the
web_user used with
deploy.yml will not yet be set up.
I see the port in the output only when I use
$ ansible-playbook server.yml -e env=production -vvv
$ ansible-playbook deploy.yml -e env=production -e site=example.com -vvv
If regular port
22, I see this in the output:
"SSH_CONNECTION": "18.104.22.168 52768 22.214.171.124 22"
126.96.36.199 is the remote host and
22 is the port.
If I change to
ansible_port=33654, I see this in the output all over the place:
I don’t know why the
ansible_port variable wouldn’t work, but here’s an alternative:
More alternatives for setting port:
remote_port in your
-o Port=33654 to
- add port to an entry for the host in local machine
--ssh-extra-args (with port) with