- name: Copy Mistral config
  sudo: true
  copy:
    src: mistral.conf
    dest: /etc/mistral/mistral.conf

- name: Set mistral config values
  sudo: true
  ini_file:
    dest=/etc/mistral/mistral.conf
    section=database
    option=connection
    value=postgresql://mistral:{{mistral_db_password}}@{{mistral_db_server}}/{{mistral_db}}

- name: Copy Mistral log config
  sudo: true
  command: cp /opt/openstack/mistral/etc/wf_trace_logging.conf.sample /etc/mistral/wf_trace_logging.conf creates=/etc/mistral/wf_trace_logging.conf

- name: Change Mistral log path
  sudo: true
  lineinfile:
    dest: /etc/mistral/wf_trace_logging.conf
    regexp: '^args=\("/var/log/mistral.log'
    line: 'args=("/var/log/mistral/mistral.log",)'

- name: Change Mistral trace path
  sudo: true
  lineinfile:
    dest: /etc/mistral/wf_trace_logging.conf
    regexp: '^args=\("/var/log/mistral_wf_trace.log'
    line: 'args=("/var/log/mistral/mistral_wf_trace.log",)'

- name: Create init config
  sudo: true
  template:
    src: init.j2
    dest: /etc/init/mistral.conf
  notify:
    - restart mistral

- name: Add Mistral config
  sudo: true
  template:
    src: mistral.conf.j2
    dest: /etc/mistral/mistral.conf
  notify:
    - restart mistral

- name: Copy Mistral log config
  sudo: true
  command: cp /opt/openstack/mistral/etc/wf_trace_logging.conf.sample /etc/mistral/wf_trace_logging.conf creates=/etc/mistral/wf_trace_logging.conf

- name: Change Mistral log path
  sudo: true
  lineinfile:
    dest: /etc/mistral/wf_trace_logging.conf
    regexp: '^args=\("/var/log/mistral.log'
    line: 'args=("/var/log/mistral/mistral.log",)'

- name: Change Mistral trace path
  sudo: true
  lineinfile:
    dest: /etc/mistral/wf_trace_logging.conf
    regexp: '^args=\("/var/log/mistral_wf_trace.log'
    line: 'args=("/var/log/mistral/mistral_wf_trace.log",)'

- name: Create init config
  sudo: true
  template:
    src: init.j2
    dest: /etc/init/mistral.conf
  notify:
    - restart mistral

Move mistral conf template to host
Move mistral conf template to host
