- name: get some vars
  set_facts:
    pla_bind_dn: "{{ lookup( 'keepass', '{{ group_names[0] }}/{{ inventory_hostname }})pla_dn', 'username' ) }}"
    pla_bin_pwd:  "{{ lookup( 'keepass', '{{ group_names[0] }}/{{ inventory_hostname }})pla_dn', 'password' ) }}"
  tags: always

  - name: get archive
  get_url:
url: https://github.com/leenooks/phpLDAPadmin/archive/{{ pla_version }}.tar.gz
dest: /tmp/pla_{{pla_version }}.gz

- package:
    name: [ php-ldap, php-xml ]
    state: present

- unarchive:
    dest: /{{ pla_install_dir }}
    src:  /tmp/pla_{{pla_version }}.gz
    remote_src: true
- file:
    src: /{{ pla_install_dir }}/phpLDAPadmin-{{ pla_version }}
    state: link
    dest: /{{ pla_install_dir }}/pla

- template:
    src: pla_config.php
    dest: /{{ pla_install_dir }}/pla/config/config.php

- name: deploy apache config
  template:
    src: pla_httpd.conf
    dest: /etc/httpd/conf.d/pla.conf
  notify: reload_apache

