Score:0

How do 2 users on ansible node connect to thesame worker node

de flag

I set up 2 new users with their respective key pairs,.. their public keys ve been established on the remote host. The problem am having is I passsed the ssh keys on the host file as follows

[remotehost:var] ansible_ssh_private_key_file=~/.ssh/user1.private_key ansible_ssh_private_key_file=~/.ssh/user2.private_key

The problem is only one user could establish ansible connection. Even tho both users can ssh into the remote host.

Am sure there’s a way set both users up to reach thesame node in the host file

Score:0
cn flag

When the users are different on the node running Ansible, you might drop the user name from the base name of the file: ~/.ssh/remotehost.private_key The path is passed to ssh, and ~ is resolved to their personal home directory.

When same local user needs to connect to multiple different remote users, can make "fake" hosts in inventory with different connection vars. ini format:

[remotehost]
remotehostuser1 ansible_user=user1 ansible_ssh_private_key_file=~/.ssh/user1.private_key
remotehostuser2 ansible_user=user2 ansible_ssh_private_key_file=~/.ssh/user2.private_key


[remotehost:vars]
ansible_host=remotehost

More ways to do this exist. Making use of the environment var way of providing a private_key_file, ${ANSIBLE_PRIVATE_KEY_FILE} Or using ssh_config.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.