---
- 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.59.0/22 --gateway 172.23.59.1
            --network vlan985 --allocation-pool start=172.23.59.75,end=172.23.59.100
            --dns-nameserver 172.23.32.248 vlan985_subnet
        - openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano
        - openstack keypair create --public-key /root/id_rsa.pub adminkey