forked from nodiscc/xsrv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
readme_gen.md.j2
124 lines (115 loc) · 8.02 KB
/
readme_gen.md.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{% for item in readme_gen_limit %}
### {{ hostvars[item].inventory_hostname }}
- Groups: **{{ ', '.join(hostvars[item].group_names) }}**
- Configuration: [host_vars/{{ hostvars[item].inventory_hostname }}/](host_vars/{{ hostvars[item].inventory_hostname }}/)
- IP addresses: `{{ ', '.join(hostvars[item]['ansible_facts']['all_ipv4_addresses'] | default('?')) }}`
- OS/Virtualization: {{ hostvars[item]['ansible_facts']['lsb']['description'] | default('?') }} ({{ hostvars[item]['ansible_facts']['virtualization_type'] | default('?') }} {{ hostvars[item]['ansible_facts']['virtualization_role'] | default('?') }})
- CPU: {{ hostvars[item]['ansible_facts']['processor'][2] | default('?') }} ({{ hostvars[item]['ansible_facts']['processor_vcpus'] | default('?')}} VCPUs)
- Memory: {{ hostvars[item]['ansible_facts']['memtotal_mb'] | default('?') }}MB
- Storage: {% for i in hostvars[item]['ansible_facts']['devices'] | default({}) | dict2items %}{% if i.value.vendor %}`{{ i.key | default('') }}: {{ i.value.size | default('') }}`{{ ', ' if not loop.last }}{% endif %}{% endfor +%}
- SSH: `ssh -p {{ hostvars[item].ansible_ssh_port|default('22') }} {{ hostvars[item].ansible_user | default('') }}@{{ hostvars[item].inventory_hostname }}` / `xsrv shell {{ xsrv_project_name|default('default') }} {{ hostvars[item].inventory_hostname }}`
- SFTP: `sftp://{{ hostvars[item].ansible_user | default('?') }}@{{ hostvars[item].inventory_hostname }}:{{ hostvars[item].ansible_ssh_port|default('22') }}`
- Logs: `xsrv logs {{ xsrv_project_name|default('default') }} {{ hostvars[item].inventory_hostname }}`
{% if hostvars[item]['ansible_facts']['ansible_local']['rsnapshot']['ansible_managed'] is defined %}
- Fetch latest backups: `xsrv fetch-backups {{ xsrv_project_name|default('default') }} {{ hostvars[item].inventory_hostname }}`
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['netdata']['ansible_managed'] is defined %}
- Monitoring (Netdata): https://{{ hostvars[item].ansible_host|default(hostvars[item].inventory_hostname) }}:{{ hostvars[item]['ansible_facts']['ansible_local']['netdata']['public_port'] }}
- Badges (Netdata): {% for badge in readme_gen_netdata_badges %}![](https://{{ hostvars[item].inventory_hostname }}:{{ hostvars[item]['ansible_facts']['ansible_local']['netdata']['public_port'] }}/api/v1/badge.svg?chart={{ badge.chart }}&alarm={{ badge.alarm }}{{ '&label=' + badge.label | urlencode if badge.label is defined else '' }}){% if not loop.last %} {% endif %}{% endfor +%}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['gitea']['fqdn'] is defined %}
- Gitea: https://{{ hostvars[item]['ansible_facts']['ansible_local']['gitea']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['gotty']['fqdn'] is defined %}
- Gotty: https://{{ hostvars[item]['ansible_facts']['ansible_local']['gotty']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['planarally']['fqdn'] is defined %}
- PlanarAlly: https://{{ hostvars[item]['ansible_facts']['ansible_local']['planarally']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['goaccess']['fqdn'] is defined %}
- Goaccess: https://{{ hostvars[item]['ansible_facts']['ansible_local']['goaccess']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['graylog']['fqdn'] is defined %}
- Graylog: https://{{ hostvars[item]['ansible_facts']['ansible_local']['graylog']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['homepage']['fqdn'] is defined %}
- Homepage: https://{{ hostvars[item]['ansible_facts']['ansible_local']['homepage']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['jellyfin']['fqdn'] is defined %}
- Jellyfin: https://{{ hostvars[item]['ansible_facts']['ansible_local']['jellyfin']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['owncast']['fqdn'] is defined %}
- Owncast: https://{{ hostvars[item]['ansible_facts']['ansible_local']['owncast']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['ollama']['fqdn'] is defined %}
- Ollama: https://{{ hostvars[item]['ansible_facts']['ansible_local']['ollama']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['stirlingpdf']['fqdn'] is defined %}
- Stirling PDF: https://{{ hostvars[item]['ansible_facts']['ansible_local']['stirlingpdf']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['moodist']['fqdn'] is defined %}
- Moodist: https://{{ hostvars[item]['ansible_facts']['ansible_local']['moodist']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['ldap_account_manager']['fqdn'] is defined %}
- LDAP Account Manager: https://{{ hostvars[item]['ansible_facts']['ansible_local']['ldap_account_manager']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['self_service_password']['fqdn'] is defined %}
- LDAP Self-Service Password: https://{{ hostvars[item]['ansible_facts']['ansible_local']['self_service_password']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['mumble']['ansible_managed'] is defined %}
- Mumble: <mumble://{{ hostvars[item].inventory_hostname }}:{{ hostvars[item]['ansible_facts']['ansible_local']['mumble']['port'] }}>
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['nextcloud']['fqdn'] is defined %}
- Nextcloud: https://{{ hostvars[item]['ansible_facts']['ansible_local']['nextcloud']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['matrix']['synapse']['fqdn'] is defined %}
- Matrix/Synapse: https://{{ hostvars[item]['ansible_facts']['ansible_local']['matrix']['synapse']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['matrix']['element']['fqdn'] is defined %}
- Matrix/Element: https://{{ hostvars[item]['ansible_facts']['ansible_local']['matrix']['element']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['jitsi']['fqdn'] is defined %}
- Jitsi: https://{{ hostvars[item]['ansible_facts']['ansible_local']['jitsi']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['rocketchat']['fqdn'] is defined %}
- Rocket.chat: https://{{ hostvars[item]['ansible_facts']['ansible_local']['rocketchat']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['rss_bridge']['fqdn'] is defined %}
- RSS-Bridge: https://{{ hostvars[item]['ansible_facts']['ansible_local']['rss_bridge']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['shaarli']['fqdn'] is defined %}
- Shaarli: https://{{ hostvars[item]['ansible_facts']['ansible_local']['shaarli']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['transmission']['fqdn'] is defined %}
- Transmission: https://{{ hostvars[item]['ansible_facts']['ansible_local']['transmission']['fqdn'] }}
{% endif %}
{% if hostvars[item]['ansible_facts']['ansible_local']['tt_rss']['fqdn'] is defined %}
- Tiny Tiny RSS: https://{{ hostvars[item]['ansible_facts']['ansible_local']['tt_rss']['fqdn'] }}
{% endif %}
{% if hostvars[item].readme_gen_comment is defined %}
- Comments: {{ hostvars[item].readme_gen_comment }}
{% endif %}
{% endfor %}
## SSH client configuration
```
# ~/.ssh/config
Include ~/.ssh/*.conf
```
```
# ~/.ssh/xsrv-{{ xsrv_project_name|default('default') }}.conf
{% for item in readme_gen_limit %}
Host {{ hostvars[item].inventory_hostname }}
HostName {{ hostvars[item].ansible_host | default(hostvars[item].inventory_hostname) }}{{ '
User ' + hostvars[item].ansible_user if hostvars[item].ansible_user is defined }}
Port {{ hostvars[item].ansible_ssh_port | default('22') }}
{% endfor %}
```
{% if readme_gen_gtk_bookmarks %}
## GTK bookmarks/SFTP
```
# ~/.config/gtk-3.0/bookmarks
{% for item in readme_gen_limit %}
sftp://{{ hostvars[item].ansible_host | default(hostvars[item].inventory_hostname) }}:{{ hostvars[item].ansible_ssh_port|default('22') }}/home/{{ hostvars[item].ansible_user | default('') }} {{ hostvars[item].inventory_hostname }}
{% endfor %}
```
{% endif %}