---

- name: Read {{ devstack_clouds_file_path }} file
  slurp:
    src: '{{ devstack_clouds_file_path }}'
  register: read_devstack_clouds_file


- name: Write clouds file to '{{ tobiko_clouds_file_path }}'
  copy:
    content: '{{ read_devstack_clouds_file.content | b64decode }}'
    dest: '{{ tobiko_clouds_file_path }}'
  delegate_to: localhost


- name: Write clouds file dir to {{ tobiko_config_path }}
  ini_file:
    path: '{{ tobiko_config_path }}'
    section: keystone
    option: clouds_file_dirs
    value: '{{ tobiko_clouds_file_path | dirname }}'
  delegate_to: localhost


- name: Write clouds file name to {{ tobiko_config_path }}
  ini_file:
    path: '{{ tobiko_config_path }}'
    section: keystone
    option: clouds_file_names
    value: '{{ tobiko_clouds_file_path | basename }}'
  delegate_to: localhost


- name: Write cloud name dir to {{ tobiko_config_path }}
  ini_file:
    path: '{{ tobiko_config_path }}'
    section: keystone
    option: cloud_name
    value: devstack-admin
  delegate_to: localhost