bsdnix/create.yaml

36 lines
970 B
YAML

- name: Create the home volume
hosts: localhost
connection: local
# FIXME: create volume role
roles:
- storage
- 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
# FIXME: doesn't work correctly yet
- 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