Benutzer-Werkzeuge

Webseiten-Werkzeuge


ansible

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
ansible [2024-04-04 14:17:49] manfredansible [2024-04-04 16:02:21] (aktuell) – [Wenn-Sonst] manfred
Zeile 12: Zeile 12:
   * [[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_lookups.html|Lookups]]   * [[https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_lookups.html|Lookups]]
  
-<code>+<code python>
 --- ---
 - name: PlayBook Betriebssystemversion anzeigen - name: PlayBook Betriebssystemversion anzeigen
Zeile 44: Zeile 44:
   > ansible-playbook -i inventory.yml -l test02 playbook_update.yml   > ansible-playbook -i inventory.yml -l test02 playbook_update.yml
  
-<file ansible inventory.yml>+<file python inventory.yml>
 --- ---
 servers: servers:
Zeile 56: Zeile 56:
 </file> </file>
  
-<file ansible include_variables.yml>+<file python include_variables.yml>
 --- ---
 ansible_python_interpreter: "/usr/bin/python3" ansible_python_interpreter: "/usr/bin/python3"
Zeile 66: Zeile 66:
 </file> </file>
  
-<file ansible include_users.yml>+<file python include_users.yml>
 --- ---
 #------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
Zeile 110: Zeile 110:
 </file> </file>
  
-<file ansible playbook_update.yml>+<file python playbook_update.yml>
 --- ---
 # ----------------------------------------------------------- # -----------------------------------------------------------
Zeile 184: Zeile 184:
 </file> </file>
  
-<file ansible playbook_add_user.yml>+<file python playbook_add_user.yml>
 --- ---
 - hosts: servers - hosts: servers
Zeile 425: Zeile 425:
 ===== File ===== ===== File =====
  
-<code>+<code python>
 --- ---
 - name: Dateien und Verzeichnisse löschen - name: Dateien und Verzeichnisse löschen
Zeile 436: Zeile 436:
 </code> </code>
  
-<code>+<code python>
 --- ---
 # Inhalte von einem Verzeichnis löschen; z.B. von einem Mount-Point # Inhalte von einem Verzeichnis löschen; z.B. von einem Mount-Point
Zeile 478: Zeile 478:
 ===== LineInFile ===== ===== LineInFile =====
  
-<code>+<code python>
 --- ---
 # ----------------------------------------------------------- # -----------------------------------------------------------
Zeile 504: Zeile 504:
 [[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/blockinfile_module.html]] [[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/blockinfile_module.html]]
  
-<code>+<code python>
 - name: Insert/Update HTML surrounded by custom markers after <body> line - name: Insert/Update HTML surrounded by custom markers after <body> line
   ansible.builtin.blockinfile:   ansible.builtin.blockinfile:
Zeile 515: Zeile 515:
 </code> </code>
  
-<code>+<code python>
 - name: Remove HTML as well as surrounding markers - name: Remove HTML as well as surrounding markers
   ansible.builtin.blockinfile:   ansible.builtin.blockinfile:
Zeile 523: Zeile 523:
 </code> </code>
  
-<code>+<code python>
     - name: Textblock aus der Datei entfernen     - name: Textblock aus der Datei entfernen
       ansible.builtin.blockinfile:       ansible.builtin.blockinfile:
Zeile 548: Zeile 548:
 Wenn die Major-Versionsnummer eine "22" (von "Ubuntu 22.04") ist, dann bleibt der Wert in der Variable ''php_version'' auf "8.1", sonst wird er mit "7.2" überschrieben: Wenn die Major-Versionsnummer eine "22" (von "Ubuntu 22.04") ist, dann bleibt der Wert in der Variable ''php_version'' auf "8.1", sonst wird er mit "7.2" überschrieben:
   ### OS-Schalter   ### OS-Schalter
-  - name: Wenn-Dann-Sonst +- name: Ubuntu 22.04 LTS 
-    set_fact: +  set_fact: 
-        php_version: "{{ '{\"php_version\": \"8.1\"}' if (ansible_distribution_major_version == '22') else '{\"php_version\" : \"7.2\"}' }}"+    php_version: "8.1" 
 +    percona_repo_version: "80" 
 +  when: 
 +    ansible_facts.lsb.major_release == "22"
  
  
Zeile 623: Zeile 626:
 [[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html]] [[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/replace_module.html]]
  
-<code>+<code python>
     - name: Replace old hostname with new hostname (requires Ansible >= 2.4)     - name: Replace old hostname with new hostname (requires Ansible >= 2.4)
       ansible.builtin.replace:       ansible.builtin.replace:
Zeile 631: Zeile 634:
 </code> </code>
  
-<code>+<code python>
     - name: Supports a validate command     - name: Supports a validate command
       ansible.builtin.replace:       ansible.builtin.replace:
/home/http/wiki/data/attic/ansible.1712240269.txt · Zuletzt geändert: von manfred