---
- hosts: localhost
  connection: local
  gather_facts: no
  tasks:
    - debug: var=instance_id
    - debug: var=image_name
    - name: create image of current worker instance
      ec2_ami:
        instance_id: "{{ instance_id }}"
        name: "{{ image_name }}"
        region: us-west-2
      register: image
    - debug: var=image

---
- hosts: localhost
  connection: local
  gather_facts: no
  vars:
    image_name: "worker-{{ DATA_BRANCH }}-{{ ansible_date_time.date }}"
  tasks:
    - debug: var=instance_id
    - debug: var=image_name
    - name: create image of current worker instance
      ec2_ami:
        instance_id: "{{ instance_id }}"
        name: "{{ image_name }}"
        region: us-west-2
      register: image
    - debug: var=image

Automate image name, worker-<data branch>-date
Automate image name, worker-<data branch>-date
