Playbook name: pb_push_config.yml
This Playbook loads and commits one or more configuration files from a local folder to the corresponding remote devices, identified by the config file name.
It first attempts via NETCONF over SSH. If is fails, it automatically tries via TELNET.
The playbook relies on the following roles:
You can check the requirements on roles' documentation.
targets
(default value =all
): it is the hosts parameter of the playbook, used to set the target hosts. It can be a group name or a device name
Suppose you need to load a configuration file on two devices whose hostnames are "my_qfx-1" and "my_qfx-2":
-
Name the configuration files so that it ends with "my_qfx-1.conf" and "my_qfx-2.conf" respectively (I.e. "my_qfx-1.conf", "2029_01_my_qfx-1.conf", "FINAL.my_qfx-1.conf", etc);
-
Place the files in the a folder called "_built_configs" inside the inventory folder. This is the default location, you can use a different folder by overriding the variables
built_configs_dir
-
Run the playbook
ansible-playbook pb_push_config.yml -i invenotry/hosts.ini
The configurations will be loaded and committed on the remote devices.