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

add SSH --key-file option to docs #2636

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

array-in-a-matrix
Copy link
Contributor

If ssh fails when using ssh keys using the --key-file flag may solve the issue.

if ssh fails when using ssh keys try using `--key-file` flag
@spantaleev
Copy link
Owner

A better way would be to adjust your inventory with the appropriate Ansible SSH key variable pointing to the key, so you can do it once and forget about it.

Adjusting ~/.ssh/config may be another option.

Passing --ssh-key everywhere sounds like the most annoying way to solve this problem.

@spatterIight
Copy link
Contributor

To throw my 2 cents in, another way is to to add a ssh_config file, relevant ssh_keys folder, and add a line to ansible.cfg

I think this is better than adjusting ~/.ssh/config since my suggested changes are localized to the repo

matrix-docker-ansible-deploy/ssh_config:

Host *
    IdentitiesOnly yes
    ServerAliveInterval 30
    UserKnownHostsFile ssh_known_hosts
    StrictHostKeyChecking accept-new

Host matrix.<matrix-domain>
     User ubuntu
     Hostname 172.28.12.5
     IdentityFile ssh_keys/matrix-key

Host *
     User root

matrix-docker-ansible-deploy/ansible.cfg

[defaults]
retry_files_enabled = False
stdout_callback = yaml

[ssh_connection]
ssh_args = -F ssh_config -o ControlMaster=auto -o ControlPersist=600s

[connection]
pipelining = True

In this way all the relevant ansible commands are the exact same, the only difference being a prompt for the key password (if there is one)

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

Successfully merging this pull request may close these issues.

None yet

3 participants