---
- hosts: all
  name: Dummy to gather facts
  tasks: []

- hosts: keystone
  become: True
  vars_files:
    - settings.yml
  tasks:
    - name: copy public key
      copy:
        content: "{{ rsa_pub }}"
        dest: /srv/keystone/root/id_rsa.pub
    - name: post install configuration
      command: docker exec -i keystone.service bash -c "source /root/admin-openrc.sh && {{ item }}"
      with_items:
        - openstack network create --share --external --provider-physical-network provider --provider-network-type vlan --provider-segment 985 vlan985
        - >
            openstack subnet create --subnet-range 172.23.34.0/24 --gateway 172.23.34.1
            --network vlan985 --allocation-pool start=172.23.34.50,end=172.23.34.60
            --dns-nameserver 8.8.4.4 vlan985_subnet
        - openstack network create --share --external --provider-physical-network provider --provider-network-type vlan --provider-segment 16 vlan16
        - >
            openstack subnet create --subnet-range 195.169.22.0/23 --gateway 195.169.23.251
            --network vlan16 --allocation-pool start=195.169.22.237,end=195.169.22.237
            --dns-nameserver 8.8.4.4 vlan16_subnet

        - openstack flavor create --ram 4096 --disk 40 --vcpus 2  "Molgenis Dual"
        - openstack flavor create --ram 16384 --disk 40 --vcpus 4  "Molgenis Quad 16GB"
        - openstack flavor create --ram 8192 --disk 40 --vcpus 4  "Molgenis Quad 8GB"

        - openstack keypair create --public-key /root/id_rsa.pub adminkey