---
- name: Generate Agent Configuration File
  become: yes
  become_user: jingrow
  command: '/home/jingrow/agent/env/bin/agent setup config --name {{ server }} --workers {{ workers }} {% if proxy_ip is defined %}--proxy-ip {{ proxy_ip }}{% endif %}'
  args:
    chdir: /home/jingrow/agent

- name: Setup Agent Authentication
  become: yes
  become_user: jingrow
  command: '/home/jingrow/agent/env/bin/agent setup authentication --password {{ agent_password }}'
  args:
    chdir: /home/jingrow/agent

- name: Setup Agent NGINX
  become: yes
  become_user: jingrow
  command: /home/jingrow/agent/env/bin/agent setup nginx
  args:
    chdir: /home/jingrow/agent
