Service template in Script

I cannot get the service template to work in the following script. Is it not scripted properly? Since I need a condition, should I create and call an Automation instead?

office_on:
  sequence:
  - service: switch.turn_on
    entity_id: switch.computer_monitors
  - service: light.turn_on
    entity_id: light.office_desk_lamp
  - service: '{% if is_state ("sun.sun", "above_horizon") %} switch.turn_on {%endif%}'
    entity_id: switch.office_floor_lamp
  mode: single
  alias: Office-On

Change the service to switch.turn_on and just use a state condition before that service call that sun.sun is below_horizon (you can use conditions in scripts or the action of an automation)

This works, assuming proper syntax. Thank you.

office_on:
  sequence:
  - service: switch.turn_on
    entity_id: switch.computer_monitors
  - service: light.turn_on
    entity_id: light.office_desk_lamp
  - condition: state
    entity_id: sun.sun
    state: 'above_horizon'
  - service: switch.turn_on
    entity_id: switch.office_floor_lamp
  mode: single
  alias: Office-On