# 踏み台
Host step
HostName xxx.xxx.xxx.xxx
User xyz
IdentityFile ~/.ssh/id_rsa
# 踏み台経由でslogin(ssh)するホスト
Host ip-10-0-0-100
HostName 10.0.0.100
ProxyCommand ssh -W %h:%p step
User ubuntu
IdentityFile ~/.ssh/aws.pem
~/.ssh/configで書くと上記の様な場合、ansibleをip-10-0-0-100で実行するにはどうするか?
ansibleのinventoryをhostsと言う名前で用意しておいて
cat hosts
...
[host]
10.0.0.100
10.0.0.101
...
ansible-playbookを実行する例
export ANSIBLE_SSH_ARGS="-o ProxyCommand=\"ssh -W %h:%p step\" -o User=ubuntu -o StrictHostKeyChecking=no"
ansible-playbook -i hosts example.yml -l 10.0.0.100 --private-key=~/.ssh/aws.pem