bsdnix/create.yaml

45 lines
1.3 KiB
YAML
Raw Normal View History

- name: Create the home volume
hosts: localhost
connection: local
# FIXME: create volume role
tasks:
- name: Create the home volume
hetzner.hcloud.volume:
# FIXME: put to vars
# FIXME: add mount to server
# FIXME: gpart create -s GPT da1 && gpart add -t freebsd-zfs -l storage -a 1M da1 && zpool create -f home da1
name: home
location: fsn1
format: ext4
size: 100
state: present
- 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