Can I use secrets.yaml in shell command?

I try like this but not working:

shell_command:
  reboot_rpi3: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa root@!secret kodi_rpi3_ip sudo reboot

script:
  script_reboot_rpi3:
    sequence:
      - service: shell_command.reboot_rp3
    shell_command:
      reboot_rpi3: !secret shell_reboot_rpi

    script:
      script_reboot_rpi3:
        sequence:
          - service: shell_command.reboot_rpi3

And in secrets

shell_reboot_rpi: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa USER@IP_ADRESS sudo reboot

(I’ve edited your shell command for best practice, you shouldn’t be allowing root logins by ssh, and also if you are going to use root you don’t need the sudo command)

Hope this helps.

1 Like

Now is working thanks @anon43302295

1 Like