Trying to write template in foreman with Ruby

Hi,
I am getting syntax error can anyone assist me?

<% if <% input(‘domain’) %> == ‘yes’ %>
<%= render_template(“Ansible Join to domain - commands - SDL”, hostname: <%= input(‘hostnamea’) -%>) -%>
echo “done - join the domain”
<% else %>
echo “done - didnt join to the domain”
<% end %>

Thanks,
shay