- name: Copy Logbus install package
  copy: src={{ item }} dest=/usr/local/src
  with_items:
    - jre.tar.gz
    - ta-logBus.zip

- name: install dependent
  yum: name={{ pkgname }} state=latest

- name: decompression logbus package
  unarchive: copy=no src=/usr/local/src/ta-logBus.zip dest=/usr/local

- name: decompression Java package
  unarchive: copy=no src=/usr/local/src/jre.tar.gz dest=/usr/local/src

- name: set Java environment
  shell: ' [ ! -d /usr/local/ta-logBus/java ] && cp -rf /usr/local/src/jre /usr/local/ta-logBus/java'
  ignore_errors: yes

- name: Template Set log_bus Config Files
  template: src='logBus.conf.j2' dest='/usr/local/ta-logBus/conf/logBus.conf'

#- name: Copy get_log_sh
#  copy: src=logbus_conf.sh dest=/usr/local/src
#
#- name: Get game_log path
#  shell: ' bash /usr/local/src/logbus_conf.sh {{ Project_name }}'
#  ignore_errors: yes

- name: copy log_bus Start Files
  copy: src='logbus.service' dest='/usr/lib/systemd/system'
  notify:
    - System reload

- name: Set logbus service status
  service: name=logbus state=started enabled=yes
  notify:
    - restart logbus service

- name: Remove logbus install package
  file:
    path: "{{ item }}"
    state: absent
  with_items:
    - /usr/local/src/ta-logBus.zip
    - /usr/local/src/jre.tar.gz
    - /usr/local/src/jre
