Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. name: Change add communti to set community
  2.  
  3. remote_user: me
  4.  
  5. ask-pass: yes
  6.  
  7. hosts: all
  8.  
  9. gather_facts: no
  10.  
  11.  
  12.  
  13. tasks:
  14.  
  15. - name: Get configuration with community add
  16.  
  17. junos_cli:
  18.  
  19. cli: 'show configuration policy | match "community add" | disp set'
  20.  
  21. dest: ~/Downloads/ansible/configuration_tb.txt
  22.  
  23.  
  24.  
  25. - name: copy local file to local machine
  26.  
  27. command: cp ~/Downloads/ansible/configuration_tb.txt ~/Downloads/ansible/configuration_delete.txt
  28.  
  29. delegate_to: 127.0.0.1
  30.  
  31.  
  32. - name: Replace configuration add community to set community
  33.  
  34. replace:
  35.  
  36. path: ~/Downloads/ansible/configuration_delete.txt
  37.  
  38. regexp: 'set'
  39.  
  40. replace: "delete"
  41.  
  42.  
  43.  
  44. - name: Replace configuration add community to set community
  45.  
  46. replace:
  47.  
  48. path: ~/Downloads/ansible/configuration_tb.txt
  49.  
  50. regexp: 'add'
  51.  
  52. replace: "set"
  53.  
  54.  
  55.  
  56. - name: Copy two files in one
  57.  
  58. command: cat ~/Downloads/ansible/configuration_delete.txt >> ~/Downloads/ansible/configuration_tb.txt
  59.  
  60. delegate_to: 127.0.0.1
  61.  
  62.  
  63.  
  64.  
  65.  
  66. - name: Install configuration file onto device
  67.  
  68. juniper_junos_config:
  69.  
  70. load: merge
  71.  
  72. src: "~/Downloads/ansible/configuration_tb.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement