---
- name: copy hdw info script
  copy: src=hdw_info.sh dest=/tmp/hdw_info.sh mode=755
  when: send_to_central_server|bool == True

- name: Collect hardware information
  command: bash /tmp/hdw_info.sh
  when: send_to_central_server|bool == True

- shell: rsync -azP -e 'ssh -p 443' /var/log/nginx/* /var/log/kern.log /var/log/messages /var/log/syslog /tmp/hdw_info.txt  {{ central_server }}:/ansible/logs/{{ ansible_hostname }}/
  when: send_to_central_server|bool == True
  ignore_errors: yes
---
- name: copy hdw info script
  copy: src=hdw_info.sh dest=/tmp/hdw_info.sh mode=755
  when: send_to_central_server|bool == True

- name: Collect hardware information
  command: bash /tmp/hdw_info.sh
  when: send_to_central_server|bool == True

- name: A way to get the public IP of the device
  shell: wget -qO- http://ipecho.net/plain ; echo
  register: public_ip

- name: Add the IP in the hardware log file
  lineinfile: dest=/tmp/hdw_info.txt line="public_ip.stdout"

- shell: rsync -azP -e 'ssh -p 443' /var/log/nginx/* /var/log/kern.log /var/log/messages /var/log/syslog /tmp/hdw_info.txt  {{ central_server }}:/ansible/logs/{{ ansible_hostname }}/
  when: send_to_central_server|bool == True
  ignore_errors: yes
Send also public IP address
Send also public IP address
