26 lines
808 B
YAML
26 lines
808 B
YAML
|
|
- name: Create BSDNIX Servers
|
||
|
|
hosts: vps
|
||
|
|
connection: local
|
||
|
|
gather_facts: False
|
||
|
|
user: root
|
||
|
|
roles:
|
||
|
|
- role: install
|
||
|
|
|
||
|
|
# during testing the ip addresses change all the time, so tune the
|
||
|
|
# known_hosts file accordingly after setup
|
||
|
|
- name: Add/cleanup public keys of all vps' to known_hosts file
|
||
|
|
hosts: localhost
|
||
|
|
connection: local
|
||
|
|
gather_facts: false
|
||
|
|
vars:
|
||
|
|
ssh_known_hosts_file: "{{ lookup('env','HOME') + '/.ssh/known_hosts' }}"
|
||
|
|
ssh_known_hosts: "{{ groups['running'] }}"
|
||
|
|
tasks:
|
||
|
|
- known_hosts:
|
||
|
|
path: "{{ ssh_known_hosts_file }}"
|
||
|
|
name: "{{ item }}"
|
||
|
|
key: "{{ lookup('pipe','ssh-keyscan -T 10 ' + item + ',' + lookup('dig',item)) }}"
|
||
|
|
state: present
|
||
|
|
loop: "{{ ssh_known_hosts | map('extract', hostvars, ['ipv6']) | list }}"
|
||
|
|
become: no
|