- name: Debug Setup Stuff
  debug:
    msg: "user_setup={{ user_setup }} & provision={{provision}} & boostrap={{bootstrap}}"

- name: Control Node Bootstrap
  include: control_node_config.yml
  when: bootstrap_controller and 'control' in inventory_hostname

- name: Setup lab user
  include: user_setup.yml
  when: user_setup

- name: Setup infrastructure
  include: provisioner.yml
  when: provision

- name: Common Bootstrapping
  include: bootstrap.yml
  when: bootstrap

- name: Email Hosts file
  delegate_to: localhost
  sendgrid:
    username: "{{ sendgrid_user }}"
    password: "{{ sendgrid_pass }}"
    subject: "[Ansible] Important Training Details"
    body: |
          Attached is the Ansible inventory file to be used for training.<br>
          Please check your ability to connect to each of the hosts.<br>
          <br>
          The username is '{{ item.username }}' and the password is 'changeme123'.<br>
          If you have any issues connecting, please reply to this email to let me know.

    to_addresses: "{{ item.email }}"
    html_body: yes
    from_address: "{{ instructor_email }}"
    attachments:
      - "{{item.username}}-instances.txt"
  with_items: "{{ users }}"
  when: email
  tags:
    - email

- name: Debug Setup Stuff
  debug:
    msg: "user_setup={{ user_setup }} & provision={{provision}} & boostrap={{bootstrap}}"

- name: Control Node Bootstrap
  include: control_node_config.yml
  when: bootstrap_controller and 'control' in inventory_hostname

- name: Setup lab user
  include: user_setup.yml
  when: user_setup

- name: Setup infrastructure
  include: provisioner.yml
  when: provision

- name: Common Bootstrapping
  include: bootstrap.yml
  when: bootstrap

- name: Email Hosts file
  delegate_to: localhost
  sendgrid:
    username: "{{ sendgrid_user }}"
    password: "{{ sendgrid_pass }}"
    subject: "[Ansible] Important Training Details"
    body: |
          Attached is the Ansible inventory file to be used for training.<br>
          Please check your ability to connect to each of the hosts.<br>
          <br>
          The username is '{{ item.username }}' and the password is 'changeme123'.<br>
          The username is '{{ item.username }}' and the password is '{{ admin_password }}'.<br>
          If you have any issues connecting, please reply to this email to let me know.

    to_addresses: "{{ item.email }}"
    html_body: yes
    from_address: "{{ instructor_email }}"
    attachments:
      - "{{item.username}}-instances.txt"
  with_items: "{{ users }}"
  when: email
  tags:
    - email

Use variable for password in email body
Use variable for password in email body
