---
# Payload Server Deployment Playbook
- name: Deploy payload server
  hosts: localhost
  gather_facts: false
  connection: local
  vars_files:
    - vars.yaml
  vars:
    deployment_id: "{{ deployment_id | default('') }}"
    payload_server_name: "{{ payload_server_name | default('ps-' + deployment_id) }}"
    provider: "{{ provider | default('aws') }}"
    
  tasks:
    - name: Deploy payload server based on provider
      include_tasks: "../providers/{{ provider | upper }}/c2.yml"
      vars:
        c2_name: "{{ payload_server_name }}"
        server_type: "payload"
        
    - name: Configure payload server
      include_tasks: "tasks/configure_payload_server.yml"
      when: not skip_configuration | default(false)