I'm trying to figure out how to configure the SSH credentials separately for a production and staging environment with Ansible. I understand that you can configure the server IP addresses and hostnames separately using different inventory files by passing the -i
or --inventory-file
argument to the ansible-playbook
command. However, I see no such option for ansible.cfg
. Currently, the credentials live in /etc/ansible/ansible.cfg
as:
[defaults]
private_key_file=/home/caleb/.ssh/staging_key.pem
remote_user=ubuntu
sudo_user=root
gathering=explicit
How can I configure multiple SSH credentials, one for production and one for staging?