I'm trying to accomplish this in a playbook using juniper_junos_config, but "replace" is not accepted as a "lines".
tasks:
- name: Run Juniper configuration commands.
juniper_junos_config:
timeout: 120
load: set
format: text
config_mode: exclusive
comment: "Performed by Ansible Playbook replace-test.yml"
commit: true
lines:
- edit system syslog
- replace pattern x.x.x.x with y.y.y.y
Original Message:
Sent: 07-16-2024 12:31
From: JACQUES GIRARDI BUSNARDO
Subject: Configuration changes using "replace pattern" via Ansible
Hi,
You can use something like this:
ansible junos_host -m junipernetworks.junos.junos_config -a '{"lines": ["replace pattern old.old.old.old with new.new.new.new"]}'
But be careful: it will replace all occurrences of "old.old.old.old" with "new.new.new.new". If you enter "edit system syslog" first, it can be more precise.
Best regards,
Jacques G. Busnardo
Original Message:
Sent: 7/16/2024 12:10:00 PM
From: cdjny
Subject: Configuration changes using "replace pattern" via Ansible
Is there anyway to use Ansible to make configuration changes via the "replace pattern" command? I want to use Ansible to make the same change to multiple devices, which is a simple "replace pattern" under a specific stanza. Basically I want to change the IP for a syslog server, without changing all of the other parameters that are already defined in the configuration stanza.