Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name: Change add communti to set community
- remote_user: me
- ask-pass: yes
- hosts: all
- gather_facts: no
- tasks:
- - name: Get configuration with community add
- junos_cli:
- cli: 'show configuration policy | match "community add" | disp set'
- dest: ~/Downloads/ansible/configuration_tb.txt
- - name: copy local file to local machine
- command: cp ~/Downloads/ansible/configuration_tb.txt ~/Downloads/ansible/configuration_delete.txt
- delegate_to: 127.0.0.1
- - name: Replace configuration add community to set community
- replace:
- path: ~/Downloads/ansible/configuration_delete.txt
- regexp: 'set'
- replace: "delete"
- - name: Replace configuration add community to set community
- replace:
- path: ~/Downloads/ansible/configuration_tb.txt
- regexp: 'add'
- replace: "set"
- - name: Copy two files in one
- command: cat ~/Downloads/ansible/configuration_delete.txt >> ~/Downloads/ansible/configuration_tb.txt
- delegate_to: 127.0.0.1
- - name: Install configuration file onto device
- juniper_junos_config:
- load: merge
- src: "~/Downloads/ansible/configuration_tb.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement