---
# Configure the undercloud to use ARA
# for ansible undercloud or standalone only.  Ansible deployment of node
- name: Install ara deps
  become: true
  pip:
    name: "{{ item }}"
    state: latest
  with_items:
    - pip
    - setuptools
  # TODO(sshnaidm): https://bugs.launchpad.net/tripleo/+bug/1792622
  ignore_errors: true

- name: Install ara
  become: true
  pip:
    name: ara
    state: present
    version: "{{ undercloud_ara_version }}"
  ignore_errors: true

- name: Update the default ansible callback setting in /etc/ansible/ansible.cfg
  become: true
  lineinfile:
    path: /etc/ansible/ansible.cfg
    regexp: '^#callback_plugins'
    line: |
      callback_plugins=/usr/lib/python2.7/site-packages/ara/plugins/callbacks

- name: Update the default ansible action setting in /etc/ansible/ansible.cfg
  become: true
  lineinfile:
    path: /etc/ansible/ansible.cfg
    regexp: '^#action_plugins'
    line: |
      action_plugins=/usr/lib/python2.7/site-packages/ara/plugins/actions

- name: Update the default ansible library setting in /etc/ansible/ansible.cfg
  become: true
  lineinfile:
    path: /etc/ansible/ansible.cfg
    regexp: '^#library'
    line: |
      library=/usr/lib/python2.7/site-packages/ara/plugins/modules
