---
- name: AEM Author CloudFormation Stack
  hosts: all
  gather_facts: no
  connection: local

  tasks:

    - name: Create random credentials for system users
      system_users_credentials:
      register: credentials
      tags:
      - create

    - name: Ensure data bucket exists
      s3_bucket:
        name: "{{ s3.data_bucket_name }}"
        state: present
      tags:
      - create

    - name: Upload Stack init script
      s3:
        bucket: "{{ s3.data_bucket_name }}"
        object: "{{ stack_prefix }}/stack-init.sh"
        src: ../../../scripts/stack-init.sh
        mode: put
      tags:
      - create

    - name: Delete stack data
      s3:
        bucket: "{{ s3.data_bucket_name }}"
        object: "{{ stack_prefix }}"
        mode: delobj
      tags:
      - delete

---
- name: AEM Author CloudFormation Stack
  hosts: all
  gather_facts: no
  connection: local

  tasks:

    - name: Create random credentials for system users
      system_users_credentials:
      register: credentials
      tags:
      - create

    - name: Ensure data bucket exists
      s3_bucket:
        name: "{{ s3.data_bucket_name }}"
        state: present
      tags:
      - create

    - name: Upload stack init script
      s3:
        bucket: "{{ s3.data_bucket_name }}"
        object: "{{ stack_prefix }}/stack-init.sh"
        src: ../../../scripts/stack-init.sh
        mode: put
      tags:
      - create

    - name: Upload stack provisioner
      s3:
        bucket: "{{ s3.data_bucket_name }}"
        object: "{{ stack_prefix }}/aem-aws-stack-provisioner.tar.gz"
        src: ../../../stage/aem-aws-stack-provisioner.tar.gz
        mode: put
      tags:
      - create

    - name: Delete stack data
      s3:
        bucket: "{{ s3.data_bucket_name }}"
        object: "{{ stack_prefix }}"
        mode: delobj
      tags:
      - delete

Add step to upload stack provisioner from stage to S3.
Add step to upload stack provisioner from stage to S3.
