Add conditionals for cloud_provider in SSH configs (#1008)
* Add conditionals for cloud_provider
* Move j2 to templates, clean up conditional logic
2 files deleted
1 files copied
1 files added
3 files modified
1 files renamed
| | |
| | | |
| | | - name: Generate host .ssh/config Template |
| | | become: no |
| | | local_action: template src={{ role_path }}/files/bastion_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} |
| | | local_action: template src={{ role_path }}/templates/bastion_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} |
| | | tags: |
| | | - gen_sshconfig_file |
| | | |
File was renamed from ansible/roles/bastion-lite/files/bastion_ssh_config.j2 |
| | |
| | | Host ec2* *.internal *.example.com |
| | | {% if cloud_provider == 'ec2' %} |
| | | Host ec2* *.internal |
| | | {% elif cloud_provider == 'osp' %} |
| | | Host *.example.com |
| | | {% endif %} |
| | | User {{remote_user}} |
| | | {% if use_own_key|bool %} |
| | | IdentityFile ~/.ssh/{{env_authorized_key}}.pem |
| | |
| | | StrictHostKeyChecking no |
| | | ConnectTimeout 60 |
| | | ConnectionAttempts 10 |
| | | {% endif %} |
| | |
| | | |
| | | - name: Generate host .ssh/config Template |
| | | become: no |
| | | local_action: template src={{ role_path }}/files/bastion_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} |
| | | local_action: template src={{ role_path }}/templates/bastion_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} |
| | | tags: |
| | | - gen_sshconfig_file |
| | | |
copy from ansible/roles/bastion-lite/files/bastion_ssh_config.j2
copy to ansible/roles/bastion/templates/bastion_ssh_config.j2
File was copied from ansible/roles/bastion-lite/files/bastion_ssh_config.j2 |
| | |
| | | Host ec2* *.internal *.example.com |
| | | {% if cloud_provider == 'ec2' %} |
| | | Host ec2* *.internal |
| | | {% elif cloud_provider == 'osp' %} |
| | | Host *.example.com |
| | | {% endif %} |
| | | User {{remote_user}} |
| | | {% if use_own_key|bool %} |
| | | IdentityFile ~/.ssh/{{env_authorized_key}}.pem |
| | |
| | | StrictHostKeyChecking no |
| | | ConnectTimeout 60 |
| | | ConnectionAttempts 10 |
| | | {% endif %} |
| | |
| | | |
| | | - name: Generate host .ssh/config Template |
| | | become: no |
| | | local_action: template src={{ role_path }}/files/host_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} |
| | | local_action: template src={{ role_path }}/templates/host_ssh_config.j2 dest={{output_dir}}/ssh-config-{{ env_type }}-{{ guid }} |
| | | |
| | | - name: copy over host .ssh/config Template |
| | | become: true |
New file |
| | |
| | | {% if cloud_provider == 'ec2' %} |
| | | Host ec2* *.internal |
| | | {% elif cloud_provider == 'osp' %} |
| | | Host *.example.com |
| | | {% endif %} |
| | | User {{remote_user}} |
| | | IdentityFile ~/.ssh/{{env_authorized_key}}.pem |
| | | ForwardAgent yes |
| | | StrictHostKeyChecking no |
| | | ConnectTimeout 60 |
| | | ConnectionAttempts 10 |