Skip to content

Instantly share code, notes, and snippets.

@ebirn
ebirn / ansible-add-string-to-line.yml
Created February 7, 2018 10:32 — forked from iAugur/ansible-add-string-to-line.yml
Ansible: Add a String to an existing line in a file
# Adapted from solution provided by http://stackoverflow.com/users/57719/chin-huang http://stackoverflow.com/a/31465939/348868
# Scenario: You want to add a group to the list of the AllowGroups in ssh_config
# before:
# AllowGroups Group1
# After:
# AllowGroups Group1 Group2
- name: Add Group to AllowGroups
replace:
backup: yes