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...")
 
 
(One intermediate revision by the same user not shown)
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
Line 16: Line 16:
== Módulo replace ==
== Módulo replace ==


  - name:          Disable Repository on Installation Manager
  <nowiki>
- name:          Disable Repository on Installation Manager
   replace:
   replace:
     path:        /var/ibm/InstallationManager/.settings/com.ibm.cic.agent.core.prefs
     path:        /var/ibm/InstallationManager/.settings/com.ibm.cic.agent.core.prefs
Line 23: Line 24:
     backup:      yes
     backup:      yes
   ignore_errors: true
   ignore_errors: true
</nowiki>


= Ver também =
= Ver também =

Latest 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