[ssh_known_hosts] ssh_known_hosts is a service not a role
parent
304f95c33b
commit
55e1fdc184
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
glob_service_ssh_known_hosts:
|
||||||
|
name: ssh_known_hosts
|
||||||
|
install_dir: /var/local/services/ssh_known_hosts
|
||||||
|
dependencies:
|
||||||
|
- python3-ldap
|
||||||
|
- python3-jinja2
|
||||||
|
git:
|
||||||
|
remote: https://gitlab.adm.crans.org/nounous/ssh_known_hosts.git
|
||||||
|
version: main
|
||||||
|
cron:
|
||||||
|
frequency: "*/10 * * * *"
|
||||||
|
config:
|
||||||
|
ldap:
|
||||||
|
server: "ldaps://{{ query('ldap', 'ip', 'tealc', 'adm') | ansible.utils.ipv4 | first }}"
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
loc_service_ssh_known_hosts:
|
||||||
|
config:
|
||||||
|
ldap:
|
||||||
|
server: "ldaps://{{ query('ldap', 'ip', 'thot', 'adm') | ansible.utils.ipv4 | first }}"
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
loc_service_ssh_known_hosts:
|
||||||
|
config:
|
||||||
|
ldap:
|
||||||
|
server: "ldaps://{{ query('ldap', 'ip', 'ft', 'adm') | ansible.utils.ipv4 | first }}"
|
|
@ -117,3 +117,8 @@ loc_bind:
|
||||||
default:
|
default:
|
||||||
type: slave
|
type: slave
|
||||||
primaries: "{{ query('ldap', 'ip', 'silice', 'adm') }}"
|
primaries: "{{ query('ldap', 'ip', 'silice', 'adm') }}"
|
||||||
|
|
||||||
|
loc_service_ssh_known_hosts:
|
||||||
|
config:
|
||||||
|
ldap:
|
||||||
|
server: "ldaps://{{ query('ldap', 'ip', 'sputnik', 'adm') | ansible.utils.ipv4 | first }}"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env ansible-playbook
|
#!/usr/bin/env ansible-playbook
|
||||||
---
|
---
|
||||||
- hosts: server
|
- hosts: server
|
||||||
|
vars:
|
||||||
|
service: "{{ glob_service_ssh_known_hosts | default({}) | combine(loc_service_ssh_known_hosts | default({})) }}"
|
||||||
roles:
|
roles:
|
||||||
- ssh_known_hosts
|
- service
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
- name:
|
|
||||||
template:
|
|
||||||
src: ssh/ssh_known_hosts.j2
|
|
||||||
dest: /etc/ssh/ssh_known_hosts
|
|
|
@ -1,9 +0,0 @@
|
||||||
{{ ansible_header | comment }}
|
|
||||||
{% set hosts = query('ldap', 'query', 'ou=hosts,dc=crans,dc=org', 'one', 'objectClass=device') %}
|
|
||||||
{% for host, device in hosts.items() | sort(attribute='0') %}
|
|
||||||
{% set cns = query('ldap', 'all_cn', hosts[host].cn[0]) | sort %}
|
|
||||||
{% set ips = query('ldap', 'all_ip', hosts[host].cn[0]) | sort %}
|
|
||||||
{% for key in query('ldap', 'ssh_keys', hosts[host].cn[0]) | sort %}
|
|
||||||
{{ hosts[host].cn[0] }},{{ cns | join(',') }},{{ ips | join(',') }} {{ key }} root@{{ hosts[host].cn[0] }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
Loading…
Reference in New Issue