# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---

- name: "toxcore daily.yml"
  debug:
    msg: "toxcore daily.yml ansible_virtualization_role {{ansible_virtualization_role|replace('NA', 'host')}}"

# these should test on the host

# delegate_to: localhost? - no - per test
- name: "usr_local_toxcore.bash"
  environment: "{{ shell_proxy_env }}"
  shell: |
    umask 0002
    bash {{TOXCORE_USR_LOCAL}}/src/usr_local_toxcore.bash \
              {{ 'test' if not ansible_check_mode }}
    exit 0
  args:
    chdir: "{{TOXCORE_USR_LOCAL}}/src"
  become: yes
  become_user: "{{ BOX_USER_NAME }}"
  ignore_errors: true
  check_mode: false

- name: "run toxcore_daily.bash"
  environment: "{{ shell_proxy_env }}"
  shell: |
    umask 0027
    echo "INFO: toxcore_log_daily {{HARDEN_LOG_DIR}}"
    cd {{USR_LOCAL}}/bin
    toxcore_daily.bash
  become: yes
  become_user: "{{ BOX_USER_NAME }}"
  register: toxcore_log_daily
  notify: summary of logs
  ignore_errors: true
  when:
    - not ansible_check_mode
    - false
