summaryrefslogtreecommitdiff
path: root/docs/automation
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-02-21 19:44:09 +0100
committerChristian Poessinger <christian@poessinger.com>2022-02-21 19:44:40 +0100
commitdb246ebed19a19d7c9f48077742523095e74b876 (patch)
tree42d997cda0a046e028388933740a1c8771e48b63 /docs/automation
parentc1c59ab096331428d41efbc30dab45400264fee7 (diff)
downloadvyos-documentation-db246ebed19a19d7c9f48077742523095e74b876.tar.gz
vyos-documentation-db246ebed19a19d7c9f48077742523095e74b876.zip
command-scripting: add example for tremote SSH op-mode commands
(cherry picked from commit 66fcc79035cdcb5c4500e5bdeba62889668df1e2)
Diffstat (limited to 'docs/automation')
-rw-r--r--docs/automation/command-scripting.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/automation/command-scripting.rst b/docs/automation/command-scripting.rst
index 1f9108f8..af93a4a8 100644
--- a/docs/automation/command-scripting.rst
+++ b/docs/automation/command-scripting.rst
@@ -45,6 +45,32 @@ prepended with ``run``, even if you haven't created a session with configure.
run show interfaces
exit
+Run commands remotely
+---------------------
+
+Sometimes you simply wan't to execute a bunch of op-mode commands via SSH on
+a remote VyOS system.
+
+.. code-block:: none
+
+ ssh 192.0.2.1 'vbash -s' <<EOF
+ source /opt/vyatta/etc/functions/script-template
+ run show interfaces
+ exit
+ EOF
+
+Will return:
+
+```
+Welcome to VyOS
+Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
+Interface IP Address S/L Description
+--------- ---------- --- -----------
+eth0 192.0.2.1/24 u/u
+lo 127.0.0.1/8 u/u
+ ::1/128
+```
+
Other script languages
----------------------