---
# Generate configuration for bootstrapping containers.

- name: Ensuring config directories exist
  become: true
  file:
    path: "{{ node_config_directory }}/nova-api-bootstrap"
    state: "directory"
    owner: "{{ config_owner_user }}"
    group: "{{ config_owner_group }}"
    mode: "0770"
  run_once: true

- name: Copying over config.json files for nova-api-bootstrap
  become: true
  template:
    src: "nova-api-bootstrap.json.j2"
    dest: "{{ node_config_directory }}/nova-api-bootstrap/config.json"
    mode: "0660"
  run_once: true

- name: Copying over nova.conf for nova-api-bootstrap
  become: true
  vars:
    service_name: "nova-api-bootstrap"
  merge_configs:
    sources:
      - "{{ role_path }}/templates/nova.conf.j2"
      - "{{ node_custom_config }}/global.conf"
      - "{{ node_custom_config }}/nova.conf"
      - "{{ node_custom_config }}/nova/nova-api.conf"
      - "{{ node_custom_config }}/nova/{{ inventory_hostname }}/nova.conf"
    dest: "{{ node_config_directory }}/nova-api-bootstrap/nova.conf"
    mode: "0660"
  run_once: true
