Ansible: Alterando o conteúdo de um arquivo

From Wiki

Exemplos

Módulo lineinfile

- name:           Define limits.conf
  lineinfile:
    dest:         /etc/security/limits.conf
    insertbefore: "# End of file"
    line:         "notes           {{ item.type }}    nofile          { { item.value }}"
  with_items:
      - { type: "soft", value: "60000"}
      - { type: "hard", value: "80000"}
 

Módulo replace

- name:          Disable Repository on Installation Manager
  replace:
    path:        /var/ibm/InstallationManager/.settings/com.ibm.cic.agent.core.prefs
    regexp:      '(\s*)RepositoryIsOpen=true(\s*)'
    replace:     '\1RepositoryIsOpen=false\2'
    backup:      yes
  ignore_errors: true
 

Ver também