Change config text with an automation

Hi

I am trying to change part of the modbus configuration, specifically the IP address, with an automation - triggered when the input_text.IP changes

I have the below but I cannot seem to get it to work. Is there a different service call that I should be using?
TIA

description: ""
mode: single
trigger: 
  platform: state
  entity_id: input_text.victron_ip
action:
  - service: replace
    data:
      path: /config/modbus2.yaml
      pattern: 'host: .*'
      repl: 'host: "{{ states('input_text.victron_ip') }}"'
      count: 1
      flags: 'm'
      start: 50

Where did you get the replace service from?

I have to admit I was stuck and came across it on google somewhere. But I dont think it is real…

It isn’t real

OK thanks. Is there a way to do what I am looking for though?

There’s no official solution I know of, and no custom components I’m aware of either.

OK ty. I was hoping for something simple where I could write a new version of the entire file with a couple of variables from the UI

host: {{ states(‘input_text.victron_ip’) }}
port: {{ states(‘input_text.victron_port’) }}
name: Modbus_name

etc etc