Advertisement
UHLHosting

find_replace

Oct 21st, 2022
1,340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.58 KB | None | 0 0
  1. ---
  2. - name: Replace
  3.   hosts: test
  4.   tasks:
  5.     - name: "Ansible Lineinfile Multiple Lines"
  6.       become: yes
  7.       become_user: root
  8.       ansible.builtin.lineinfile:
  9.         path: /usr/local/apnscp/resources/templates/plans/basic/bandwidth
  10.         # Line to Search/Match against
  11.         regexp: '{{ item.From }}'
  12.         # Line to Replace with
  13.         line: '{{ item.To }}'
  14.         state: present
  15.       with_items:
  16.         - { From: 'enabled = 0', To: 'enabled = 1'}
  17.         - { From: 'threshold = 50', To: 'threshold = 200'}
  18.         - { From: 'units = GB', To: 'units = TB'}
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement