- name: Create process_exporter directory
  file: path=/usr/local/process_exporter state=directory mode=0755
  ignore_errors: yes

- name: Copy Process_exporter Packages
  copy: src={{ item }} dest=/usr/local/process_exporter
  with_items:
    - process_exporter
    - config.yaml
#    - gen_procexp_config.sh
#
#- name: Get config.yaml
#  shell: /bin/bash /usr/local/process_exporter/gen_procexp_config.sh && sleep 5
#  ignore_errors: yes
#  notify:
#    - restart process_exporter service too

- name: Modifying File process_exporter
  file: path=/usr/local/process_exporter/process_exporter owner=root group=root mode=0755

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

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

