diff options
Diffstat (limited to 'docs/automation')
| -rw-r--r-- | docs/automation/cloud-init.rst | 7 | ||||
| -rw-r--r-- | docs/automation/command-scripting.rst | 12 | ||||
| -rw-r--r-- | docs/automation/index.rst | 3 | ||||
| -rw-r--r-- | docs/automation/vyos-ansible.rst | 2 | ||||
| -rw-r--r-- | docs/automation/vyos-api.rst | 20 | ||||
| -rw-r--r-- | docs/automation/vyos-napalm.rst | 2 | ||||
| -rw-r--r-- | docs/automation/vyos-netmiko.rst | 2 | ||||
| -rw-r--r-- | docs/automation/vyos-salt.rst | 216 | 
8 files changed, 250 insertions, 14 deletions
diff --git a/docs/automation/cloud-init.rst b/docs/automation/cloud-init.rst index 7d0cc036..2fa102b1 100644 --- a/docs/automation/cloud-init.rst +++ b/docs/automation/cloud-init.rst @@ -50,7 +50,7 @@ In VyOS, by default, enables only two modules:  * ``write_files`` - this module allows to insert any files into the filesystem    before the first boot, for example, pre-generated encryption keys, -  certificates, or even a whole ``config.boot`` file. +  certificates, or even a whole ``config.boot`` file. The format is described in the cloudinit documentation `Cloud-init-write_files`_.  * ``vyos_userdata`` - the module accepts a list of CLI configuration commands in    a ``vyos_config_commands`` section, which gives an easy way to configure the @@ -267,7 +267,7 @@ Most important keys that needs to be considered:  Generate qcow image  ------------------- -A VyOS qcow image with cloud-init options is needed. This can be obteined +A VyOS qcow image with cloud-init options is needed. This can be obtained  using `vyos-vm-images`_ repo. After clonning the repo, edit the file  **qemu.yml** and comment the **download-iso** role. @@ -427,5 +427,6 @@ References  .. _vyos-vm-images: https://github.com/vyos/vyos-vm-images  .. _cloud-init-docs: https://docs.vyos.io/en/equuleus/automation/cloud-init.html?highlight=cloud-init#vyos-cloud-init  .. _Cloud-init-Support: https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_cloud_init +.. _Cloud-init-write_files: https://cloudinit.readthedocs.io/en/latest/topics/examples.html#writing-out-arbitrary-files -.. start_vyoslinter
\ No newline at end of file +.. start_vyoslinter diff --git a/docs/automation/command-scripting.rst b/docs/automation/command-scripting.rst index 7cf31232..64564e5a 100644 --- a/docs/automation/command-scripting.rst +++ b/docs/automation/command-scripting.rst @@ -1,4 +1,4 @@ -:lastproofread: 2021-06-27 +:lastproofread: 2023-01-16  .. _command-scripting: @@ -28,7 +28,7 @@ example, if you want to disable a BGP peer on VRRP transition to backup:    #!/bin/vbash    source /opt/vyatta/etc/functions/script-template    configure -  set protocols bgp local-as 65536 +  set protocols bgp system-as 65536    set protocols bgp neighbor 192.168.2.1 shutdown    commit    exit @@ -83,10 +83,10 @@ Here is a simple example:  .. code-block:: python -  #!/usr/bin/env python -  print "delete firewall group address-group somehosts" -  print "set firewall group address-group somehosts address '192.0.2.3'" -  print "set firewall group address-group somehosts address '203.0.113.55'" +  #!/usr/bin/env python3 +  print("delete firewall group address-group somehosts") +  print("set firewall group address-group somehosts address '192.0.2.3'") +  print("set firewall group address-group somehosts address '203.0.113.55'")  .. code-block:: none diff --git a/docs/automation/index.rst b/docs/automation/index.rst index f9049c48..dd7b596a 100644 --- a/docs/automation/index.rst +++ b/docs/automation/index.rst @@ -3,7 +3,7 @@ VyOS Automation  ############### -  * Saltstack +  * Nornir    * startup scripts @@ -14,5 +14,6 @@ VyOS Automation     vyos-ansible     vyos-napalm     vyos-netmiko +   vyos-salt     command-scripting     cloud-init diff --git a/docs/automation/vyos-ansible.rst b/docs/automation/vyos-ansible.rst index e02d06a9..0ebcb924 100644 --- a/docs/automation/vyos-ansible.rst +++ b/docs/automation/vyos-ansible.rst @@ -1,4 +1,4 @@ -:lastproofread: 2021-06-28 +:lastproofread: 2023-01-16  .. _vyos-ansible: diff --git a/docs/automation/vyos-api.rst b/docs/automation/vyos-api.rst index 8bc33d53..efd00dd8 100644 --- a/docs/automation/vyos-api.rst +++ b/docs/automation/vyos-api.rst @@ -1,4 +1,4 @@ -:lastproofread: 2021-06-28 +:lastproofread: 2023-01-16  .. _vyosapi: @@ -125,6 +125,24 @@ For example, get the addresses of a ``dum0`` interface.        "error": null     } +/reset +====== + +The ``reset`` endpoint run a ``reset`` command. + +.. code-block:: none + +   curl --location --request POST 'https://vyos/reset' \ +   --form data='{"op": "reset", "path": ["ip", "bgp", "192.0.2.11"]}' \ +   --form key='MY-HTTPS-API-PLAINTEXT-KEY' + +   respone: +   { +     "success": true, +     "data": "", +     "error": null +   } +  /image  ====== diff --git a/docs/automation/vyos-napalm.rst b/docs/automation/vyos-napalm.rst index 5ff7c01f..75e20b3c 100644 --- a/docs/automation/vyos-napalm.rst +++ b/docs/automation/vyos-napalm.rst @@ -1,4 +1,4 @@ -:lastproofread: 2021-06-28 +:lastproofread: 2023-01-16  .. _vyos-napalm: diff --git a/docs/automation/vyos-netmiko.rst b/docs/automation/vyos-netmiko.rst index 3627e5c3..e57e0c78 100644 --- a/docs/automation/vyos-netmiko.rst +++ b/docs/automation/vyos-netmiko.rst @@ -1,4 +1,4 @@ -:lastproofread: 2021-06-28 +:lastproofread: 2023-01-16  .. _vyos-netmiko: diff --git a/docs/automation/vyos-salt.rst b/docs/automation/vyos-salt.rst new file mode 100644 index 00000000..12be32a1 --- /dev/null +++ b/docs/automation/vyos-salt.rst @@ -0,0 +1,216 @@ +:lastproofread: 2023-01-16 + +.. _vyos-salt: + +.. include:: /_include/need_improvement.txt + +Salt +==== + +VyOS supports op-mode and configuration via salt_. + +Without proxy it requires VyOS minion configuration +and supports op-mode data: + +.. code-block:: none + +  set service salt-minion id 'r14' +  set service salt-minion master '192.0.2.250' + +Check salt-keys on the salt master + +.. code-block:: none + +  / # salt-key --list-all +  Accepted Keys: +  r11 +  Denied Keys: +  Unaccepted Keys: +  r14 +  Rejected Keys: + +Accept minion key + +.. code-block:: none + +  / # salt-key --accept r14 +  The following keys are going to be accepted: +  Unaccepted Keys: +  r14 +  Proceed? [n/Y] y +  Key for minion r14 accepted. + + + +Check that salt master can communicate with minions + +.. code-block:: none + +  / # salt '*' test.ping +  r14: +      True +  r11: +      True + +At this step we can get some op-mode information from VyOS nodes: + +.. code-block:: none + +  / # salt '*' network.interface eth0 +  r11: +      |_ +        ---------- +        address: +            192.0.2.11 +        broadcast: +            192.0.2.255 +        label: +            eth0 +        netmask: +            255.255.255.0 +  r14: +      |_ +        ---------- +        address: +            192.0.2.14 +        broadcast: +            192.0.2.255 +        label: +            eth0 +        netmask: +            255.255.255.0 + + +  / # salt r14 network.arp +  r14: +      ---------- +      aa:bb:cc:dd:f3:db: +          192.0.2.1 +      aa:bb:cc:dd:2e:80: +          203.0.113.1 + + + + +Netmiko-proxy +------------- + +It is possible to configure VyOS via netmiko_ proxy module. +It requires a minion with installed packet  ``python3-netmiko`` module +who has a connection to VyOS nodes. Salt-minion have to communicate +with salt master + +Configuration +^^^^^^^^^^^^^ + +Salt master configuration: + +.. code-block:: none + +  / # cat /etc/salt/master +  file_roots: +    base: +      - /srv/salt/states + +  pillar_roots: +    base: +      - /srv/salt/pillars + +Structure of /srv/salt: + +.. code-block:: none + +  / # tree /srv/salt/ +  /srv/salt/ +  |___ pillars +  |      |__ r11-proxy.sls +  |      |__ top.sls +  |___ states +         |__ commands.txt + +top.sls + +.. code-block:: none + +  / # cat /srv/salt/pillars/top.sls +  base: +    r11-proxy: +      - r11-proxy + + +r11-proxy.sls Includes parameters for connecting to salt-proxy minion + +.. code-block:: none + +  / # cat /srv/salt/pillars/r11-proxy.sls  +  proxy: +    proxytype: netmiko # how to connect to proxy minion, change it +    device_type: vyos  #  +    host: 192.0.2.250 +    username: user +    password: secret_passwd + +commands.txt + +.. code-block:: none + +  / # cat /srv/salt/states/commands.txt  +  set interfaces ethernet eth0 description 'WAN' +  set interfaces ethernet eth1 description 'LAN' + +Check that proxy minion is alive: + +.. code-block:: none + +  / # salt r11-proxy test.ping +  r11-proxy: +      True +  / # + +Examples +^^^^^^^^ + +Example of op-mode: + +.. code-block:: none + +  / # salt r11-proxy netmiko.send_command 'show interfaces ethernet eth0 brief' host=192.0.2.14 device_type=vyos username=vyos password=vyos +  r11-proxy: +      Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down +      Interface        IP Address                        S/L  Description +      ---------        ----------                        ---  ----------- +      eth0             192.0.2.14/24                     u/u  Upstream +  / #  + +Example of configuration: + +.. code-block:: none + +  / # salt r11-proxy netmiko.send_config config_commands=['set interfaces ethernet eth0 description Link_to_WAN'] commit=True host=192.0.2.14 device_type=vyos username=vyos password=vyos +  r11-proxy: +      configure +      set interfaces ethernet eth0 description Link_to_WAN +      [edit] +      vyos@r14# commit +      [edit] +      vyos@r14# +  / # + +Example of configuration commands from the file "/srv/salt/states/commands.txt" + +.. code-block:: none + +  / # salt r11-proxy netmiko.send_config config_file=salt://commands.txt commit=True host=192.0.2.11 device_type=vyos username=vyos password=vyos +  r11-proxy: +      configure +      set interfaces ethernet eth0 description 'WAN' +      [edit] +      vyos@r1# set interfaces ethernet eth1 description 'LAN' +      [edit] +      vyos@r1# commit +      [edit] +      vyos@r1# +  / # + +.. _salt: https://docs.saltproject.io/en/latest/contents.html +.. _netmiko: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.netmiko_mod.html#module-salt.modules.netmiko_mod
\ No newline at end of file  | 
