Ansible: Alterando o conteúdo de um arquivo

From Wiki
Revision as of 01:19, 14 September 2018 by Ebasso (talk | contribs) (→‎Módulo replace)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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