teaching-webterm/ansible/templates/sshwifty.conf.j2

67 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-06-16 15:53:52 +00:00
{# vim: set ts=2 sw=2 et ft=jinja2 : #}
2022-05-26 15:31:39 +00:00
{
{# "HostName": "localhost", #}
"SharedKey": "{{ sshwifty_shared_key }}",
"DialTimeout": 10,
"Servers": [
{
"ListenInterface": "0.0.0.0",
"ListenPort": 8182,
"InitialTimeout": 3,
"ReadTimeout": 60,
"WriteTimeout": 60,
"HeartbeatTimeout": 20,
"ReadDelay": 10,
"WriteDelay": 10 {# , #}
{# "TLSCertificateFile": "", #}
{# "TLSCertificateKeyFile": "" #}
}
],
"Presets": [
2022-06-16 15:53:52 +00:00
{%- for host in groups['role_mongo'] -%}
{%- set server_group_id = loop.index0 // mongo_replicas_count -%}
{%- set server_index = loop.index0 % mongo_replicas_count -%}
{%- set server_ip_addr = hostvars[host]['ansible_facts']['default_ipv4']['address'] -%}
{%- if server_group_id == mongo_group_id -%}
2022-05-30 19:35:02 +00:00
{
"Title": "Group {{ server_group_id }} - Server {{ server_index }} ({{ host }})",
"Type": "SSH",
"Host": "{{ server_ip_addr }}:22",
"Meta": {
"User": "{{ sshwifty_ssh_user }}",
2022-06-16 15:53:52 +00:00
{%- if "password" == sshwifty_authentication | lower -%}
2022-05-30 19:35:02 +00:00
"Authentication": "Password",
"Password": "{{ sshwifty_ssh_password }}",
2022-06-16 15:53:52 +00:00
{%- else -%}
2022-05-30 19:35:02 +00:00
"Authentication": "Private Key",
"Private Key": "file://{{ sshwifty_ssh_private_key }}",
2022-06-16 15:53:52 +00:00
{%- endif -%}
2022-05-30 19:35:02 +00:00
{# "Fingerprint": home"SHA256:bgO...." #}
"Encoding": "utf-8"
}
2022-06-16 15:53:52 +00:00
}{%- if sshwifty_gateway_access or (server_index + 1) < mongo_replicas_count -%},{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if sshwifty_gateway_access -%}
2022-05-26 15:31:39 +00:00
{
2022-05-30 19:35:02 +00:00
"Title": "Group {{ mongo_group_id }} - Gateway ({{ ansible_facts['hostname'] }})",
2022-05-26 15:31:39 +00:00
"Type": "SSH",
2022-05-30 19:35:02 +00:00
"Host": "{{ ansible_ssh_host }}:22",
2022-05-26 15:31:39 +00:00
"Meta": {
2022-05-30 19:35:02 +00:00
"User": "{{ sshwifty_ssh_user }}",
2022-06-16 15:53:52 +00:00
{%- if "password" == sshwifty_authentication | lower -%}
2022-05-30 19:35:02 +00:00
"Authentication": "Password",
"Password": "{{ sshwifty_ssh_password }}",
2022-06-16 15:53:52 +00:00
{%- else -%}
2022-05-30 19:35:02 +00:00
"Authentication": "Private Key",
"Private Key": "file://{{ sshwifty_ssh_private_key }}",
2022-06-16 15:53:52 +00:00
{%- endif -%}
2022-05-26 15:31:39 +00:00
{# "Fingerprint": "SHA256:bgO...." #}
2022-05-30 19:35:02 +00:00
"Encoding": "utf-8"
2022-05-26 15:31:39 +00:00
}
}
2022-06-16 15:53:52 +00:00
{%- endif -%}
2022-05-26 15:31:39 +00:00
],
"OnlyAllowPresetRemotes": true
}