Ansible: Alterando o conteúdo de um arquivo: Difference between revisions

From Wiki
(Criou a página com "= Exemplos = == Módulo lineinfile == <nowiki> - name: Define limits.conf lineinfile: dest: /etc/security/limits.conf insertbefore: "# End o...")
 
Line 4: Line 4:


  <nowiki>
  <nowiki>
  - name:          Define limits.conf
- name:          Define limits.conf
   lineinfile:
   lineinfile:
     dest:        /etc/security/limits.conf
     dest:        /etc/security/limits.conf

Revision as of 01:19, 14 September 2018

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