Mitesh Sharma
2020-01-16 873d8f33340b0473b6e495392f4d0da588d769b9
ssh_config template update for bastion and set_env_authorized_key roles
2 files modified
29 ■■■■■ changed files
ansible/roles/bastion/files/bastion_ssh_config.j2 16 ●●●●● patch | view | raw | blame | history
ansible/roles/set_env_authorized_key/files/host_ssh_config.j2 13 ●●●●● patch | view | raw | blame | history
ansible/roles/bastion/files/bastion_ssh_config.j2
@@ -1,3 +1,4 @@
{% if cloud_provider == 'ec2' %}
Host ec2* *.internal *.example.com
  User {{remote_user}}
{% if use_own_key|bool %}
@@ -9,3 +10,18 @@
  StrictHostKeyChecking no
  ConnectTimeout 60
  ConnectionAttempts 10
{% endif %}
{% if cloud_provider == 'osp' %}
{% set ip_octet = hostvars['bastion'].private_ip_address.split('.') %}
Host {{ ip_octet[0]+'.'+ip_octet[1] }}.*
  User {{remote_user}}
{% if use_own_key|bool %}
  IdentityFile ~/.ssh/{{env_authorized_key}}.pem
{% else %}
  IdentityFile ~/.ssh/{{key_name}}.pem
{% endif %}
  ForwardAgent yes
  StrictHostKeyChecking no
  ConnectTimeout 60
  ConnectionAttempts 10
{% endif %}
ansible/roles/set_env_authorized_key/files/host_ssh_config.j2
@@ -1,3 +1,4 @@
{% if cloud_provider == 'ec2' %}
Host ec2* *.internal *.example.com
   User {{remote_user}}
   IdentityFile ~/.ssh/{{env_authorized_key}}.pem
@@ -5,3 +6,15 @@
   StrictHostKeyChecking no
   ConnectTimeout 60
   ConnectionAttempts 10
{% endif %}
{% if cloud_provider == 'osp' %}
{% set ip_octet = hostvars['bastion'].private_ip_address.split('.') %}
Host {{ ip_octet[0]+'.'+ip_octet[1] }}.*
   User {{remote_user}}
   IdentityFile ~/.ssh/{{env_authorized_key}}.pem
   ForwardAgent yes
   StrictHostKeyChecking no
   ConnectTimeout 60
   ConnectionAttempts 10
{% endif %}