Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende ÜberarbeitungLetzte ÜberarbeitungBeide Seiten der Revision | ||
centos:ansible:basics [28.06.2020 12:10. ] – [Variablen] django | centos:ansible:basics [29.03.2022 18:17. ] – [Ansible] django | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Ansible ====== | ====== Ansible ====== | ||
{{: | {{: | ||
- | Einzelne Serversysteme mag man durchaus noch manuell einzeln installieren, | + | Einzelne Serversysteme mag man durchaus noch manuell einzeln installieren, |
+ | * Wiederkehrende und auch regelmässige Konfigurationsaufgaben und Tätigkeiten sollen automatisiert werden, um somit, | ||
+ | * Fehler bei manuellen Tätigkeiten bei copy & Paste, z.B. aus Dokumentationen wie z.B. aus diesem WIKI hier zu vermeiden, um auch dadurch | ||
+ | * wertvolle Ressourcen im speziellen hier die Arbeits- und Lebenszeit einzusparen. Darüber hinaus möchten wir auch sicherstellen, | ||
+ | * Aufgaben reproduzierbar nachvollzogen und auch bei Bedarf versioniert werden können. Zu guter Letzt wollen wir auch aus Sicherheitsaspekten \\ heraus die Administration und Konfiguration von einer zentralen Stelle aus bewerkstelligen und absichern. | ||
+ | |||
+ | Genau in solchen Umgebungen bedient man sich daher der Automatisierung bzw. Orchestrierung. | ||
Doch was versteht man nun unter diesem Begriff Orchestrierung? | Doch was versteht man nun unter diesem Begriff Orchestrierung? | ||
Zeile 11: | Zeile 17: | ||
- Ansible kann in der Community Edition kostenlos genutzt werden. Darüber hinaus bietet aber Red Hat aber auch kostenpflichtige Editionen mit grafischer Oberfläche und Support an. | - Ansible kann in der Community Edition kostenlos genutzt werden. Darüber hinaus bietet aber Red Hat aber auch kostenpflichtige Editionen mit grafischer Oberfläche und Support an. | ||
- Eine der grössten Vorteile von Ansible, sind die vorgefertigten " | - Eine der grössten Vorteile von Ansible, sind die vorgefertigten " | ||
- | - Ein weiterer Vorteil von Ansible, ist der Umstand dass kein separater eigener Server aufgesetzt werden muss, um Ansible und seine Paybooks zu nutzen. Der (Client-)Rechner, | + | - Ein weiterer Vorteil von Ansible, ist der Umstand dass kein separater eigener Server aufgesetzt werden muss, um Ansible und seine Paybooks zu nutzen. Der (Client-)Rechner, |
- | - Gegenüber Chef und Puppet ist die einfachere Verwaltung und Verwendung von Ansible, da z.B. keine zusätzliche Software auf dem zu verwaltenden System benötigt wird. Die Definitionen erfolgen im JSON-Format. Zusätzliche optionale Module können aber auch in jeder beliebigen Programmiersprache geschrieben sein. Hauptsächlich werden [[https:// | + | - Gegenüber Chef und Puppet ist die einfachere Verwaltung und Verwendung von Ansible, da z.B. keine zusätzliche Software auf dem zu verwaltenden System benötigt wird. Die Definitionen erfolgen im JSON-Format. Zusätzliche optionale Module können aber auch in jeder beliebigen Programmiersprache geschrieben sein. Hauptsächlich werden [[https:// |
===== Grundlagen ===== | ===== Grundlagen ===== | ||
==== Dokumentation ==== | ==== Dokumentation ==== | ||
Zeile 20: | Zeile 26: | ||
=== Gourav Shah - Ansible Playbook Essentials === | === Gourav Shah - Ansible Playbook Essentials === | ||
- | Ein weiteres sehr gutes Fachbuch zu Ansible in englischer Sprache ist das Buch **Ansible Playbook Essentials** von **//Gourav Shah//**, erhältlich als **[[https:// | + | Ein weiteres sehr gutes Fachbuch zu Ansible in englischer Sprache ist das Buch **Ansible Playbook Essentials** von **//Gourav Shah//**, erhältlich als **[[https:// |
{{ : | {{ : | ||
+ | |||
+ | === Axel Miesen - Ansible für Administratoren und DevOps-Teams === | ||
+ | Das dritte Buch (aktuelle Auflage von August 2020) im Bunde, welches sehr zu empfehlen ist, ist das Buch **Ansible - Das Praxisbuch für Administratoren und DevOps-Teams** von **//Axel Miesen//**, erschienen im Verlag [[https:// | ||
+ | {{ : | ||
=== online-Dokumentation === | === online-Dokumentation === | ||
Zeile 760: | Zeile 770: | ||
# ansible --version | # ansible --version | ||
- | < | + | < |
- | config file = /etc/ansible/ | + | config file = /home/django/.ansible.cfg |
- | configured module search path = ['/root/ | + | configured module search path = ['/home/django/ |
- | ansible python module location = / | + | ansible python module location = / |
executable location = / | executable location = / | ||
- | python version = 3.7.5 (default, | + | python version = 3.8.5 (default, |
Sehen wir uns nun an, wie wir die zuvor gestelle Aufgabe des gleichzeitigen Neustarts von einer Gruppe Server parallelisiert anstoßen können. Im folgenden Beispiel wollen wir in der **Gruppe** **'' | Sehen wir uns nun an, wie wir die zuvor gestelle Aufgabe des gleichzeitigen Neustarts von einer Gruppe Server parallelisiert anstoßen können. Im folgenden Beispiel wollen wir in der **Gruppe** **'' | ||
Zeile 790: | Zeile 800: | ||
$ ansible intranet -m yum -a "name = chrony state = latest" | $ ansible intranet -m yum -a "name = chrony state = latest" | ||
+ | ==== Module - Dokumentation ==== | ||
+ | Ansible bringt bei der Installation eine Vielzahl von Modulen, die sich im Verzeichnis **'' | ||
+ | |||
+ | Wie diese **[[https:// | ||
+ | |||
+ | Also entweder im Falle des Modules**dnf** die Webseite https:// | ||
+ | $ ansible-doc dnf | ||
+ | < | ||
+ | |||
+ | Installs, upgrade, removes, and lists packages and groups with the `dnf' package | ||
+ | manager. | ||
+ | |||
+ | * This module is maintained by The Ansible Core Team | ||
+ | OPTIONS (= is mandatory): | ||
+ | |||
+ | - allow_downgrade | ||
+ | Specify if the named package and version is allowed to downgrade a maybe already | ||
+ | installed higher version of that package. Note that setting allow_downgrade=True can | ||
+ | make this module behave in a non-idempotent way. The task could end up with a set of | ||
+ | packages that does not match the complete list of specified packages to install | ||
+ | (because dependencies between the downgraded package and others can cause changes to | ||
+ | the packages which were in the earlier transaction). | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - autoremove | ||
+ | If `yes', removes all " | ||
+ | dependencies of user-installed packages but which are no longer required by any such | ||
+ | package. Should be used alone or when state is `absent' | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - bugfix | ||
+ | If set to `yes', and `state=latest' | ||
+ | bugfix related. | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - conf_file | ||
+ | The remote dnf configuration file to use for the transaction. | ||
+ | [Default: (null)] | ||
+ | |||
+ | - disable_excludes | ||
+ | Disable the excludes defined in DNF config files. | ||
+ | If set to `all', disables all excludes. | ||
+ | If set to `main', | ||
+ | If set to `repoid', | ||
+ | [Default: (null)] | ||
+ | version_added: | ||
+ | |||
+ | - disable_gpg_check | ||
+ | Whether to disable the GPG checking of signatures of packages being installed. Has an | ||
+ | effect only if state is `present' | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | |||
+ | - disable_plugin | ||
+ | `Plugin' | ||
+ | not persist beyond the transaction. | ||
+ | [Default: (null)] | ||
+ | version_added: | ||
+ | |||
+ | - disablerepo | ||
+ | `Repoid' | ||
+ | not persist beyond the transaction. When specifying multiple repos, separate them with | ||
+ | a "," | ||
+ | [Default: (null)] | ||
+ | |||
+ | - download_dir | ||
+ | Specifies an alternate directory to store packages. | ||
+ | Has an effect only if `download_only' | ||
+ | [Default: (null)] | ||
+ | type: str | ||
+ | version_added: | ||
+ | |||
+ | - download_only | ||
+ | Only download the packages, do not install them. | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - enable_plugin | ||
+ | `Plugin' | ||
+ | persist beyond the transaction. | ||
+ | [Default: (null)] | ||
+ | version_added: | ||
+ | |||
+ | - enablerepo | ||
+ | `Repoid' | ||
+ | not persist beyond the transaction. When specifying multiple repos, separate them with | ||
+ | a "," | ||
+ | [Default: (null)] | ||
+ | |||
+ | - exclude | ||
+ | Package name(s) to exclude when state=present, | ||
+ | separated string. | ||
+ | [Default: (null)] | ||
+ | version_added: | ||
+ | |||
+ | - install_repoquery | ||
+ | This is effectively a no-op in DNF as it is not needed with DNF, but is an accepted | ||
+ | parameter for feature parity/ | ||
+ | [Default: yes] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - install_weak_deps | ||
+ | Will also install all packages linked by a weak dependency relation. | ||
+ | [Default: yes] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - installroot | ||
+ | Specifies an alternative installroot, | ||
+ | [Default: /] | ||
+ | version_added: | ||
+ | |||
+ | - list | ||
+ | Various (non-idempotent) commands for usage with `/ | ||
+ | playbooks. See examples. | ||
+ | [Default: (null)] | ||
+ | |||
+ | - lock_timeout | ||
+ | Amount of time to wait for the dnf lockfile to be freed. | ||
+ | [Default: 30] | ||
+ | type: int | ||
+ | version_added: | ||
+ | |||
+ | = name | ||
+ | A package name or package specifier with version, like `name-1.0' | ||
+ | state=latest, | ||
+ | or a local path to a rpm file. To operate on several packages this can accept a comma | ||
+ | separated string of packages or a list of packages. | ||
+ | (Aliases: pkg) | ||
+ | elements: str | ||
+ | type: list | ||
+ | |||
+ | - releasever | ||
+ | Specifies an alternative release from which all packages will be installed. | ||
+ | [Default: (null)] | ||
+ | version_added: | ||
+ | |||
+ | - security | ||
+ | If set to `yes', and `state=latest' | ||
+ | security related. | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - skip_broken | ||
+ | Skip packages with broken dependencies(devsolve) and are causing problems. | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - state | ||
+ | Whether to install (`present', | ||
+ | Default is `None', | ||
+ | `autoremove' | ||
+ | (Choices: absent, present, installed, removed, latest)[Default: | ||
+ | |||
+ | - update_cache | ||
+ | Force dnf to check if cache is out of date and redownload if needed. Has an effect only | ||
+ | if state is `present' | ||
+ | (Aliases: expire-cache)[Default: | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - update_only | ||
+ | When using latest, only update installed packages. Do not install packages. | ||
+ | Has an effect only if state is `latest' | ||
+ | [Default: no] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | - validate_certs | ||
+ | This only applies if using a https url as the source of the rpm. e.g. for localinstall. | ||
+ | If set to `no', the SSL certificates will not be validated. | ||
+ | This should only set to `no' used on personally controlled sites using self-signed | ||
+ | certificates as it avoids verifying the source site. | ||
+ | [Default: yes] | ||
+ | type: bool | ||
+ | version_added: | ||
+ | |||
+ | |||
+ | NOTES: | ||
+ | * When used with a `loop:` each package will be processed individually, | ||
+ | more efficient to pass the list directly to the `name` option. | ||
+ | * Group removal doesn' | ||
+ | upstream dnf's API doesn' | ||
+ | removal the module is unable to detect that the group is installed | ||
+ | (https:// | ||
+ | |||
+ | |||
+ | REQUIREMENTS: | ||
+ | |||
+ | AUTHOR: Igor Gnatenko (@ignatenkobrain) < | ||
+ | METADATA: | ||
+ | status: | ||
+ | - stableinterface | ||
+ | supported_by: | ||
+ | | ||
+ | |||
+ | EXAMPLES: | ||
+ | |||
+ | - name: install the latest version of Apache | ||
+ | dnf: | ||
+ | name: httpd | ||
+ | state: latest | ||
+ | |||
+ | - name: install the latest version of Apache and MariaDB | ||
+ | dnf: | ||
+ | name: | ||
+ | - httpd | ||
+ | - mariadb-server | ||
+ | state: latest | ||
+ | |||
+ | - name: remove the Apache package | ||
+ | dnf: | ||
+ | name: httpd | ||
+ | state: absent | ||
+ | |||
+ | - name: install the latest version of Apache from the testing repo | ||
+ | dnf: | ||
+ | name: httpd | ||
+ | enablerepo: testing | ||
+ | state: present | ||
+ | |||
+ | - name: upgrade all packages | ||
+ | dnf: | ||
+ | name: " | ||
+ | state: latest | ||
+ | |||
+ | - name: install the nginx rpm from a remote repo | ||
+ | dnf: | ||
+ | name: ' | ||
+ | state: present | ||
+ | |||
+ | - name: install nginx rpm from a local file | ||
+ | dnf: | ||
+ | name: / | ||
+ | state: present | ||
+ | |||
+ | - name: install the ' | ||
+ | dnf: | ||
+ | name: ' | ||
+ | state: present | ||
+ | |||
+ | - name: Autoremove unneeded packages installed as dependencies | ||
+ | dnf: | ||
+ | autoremove: yes | ||
+ | |||
+ | - name: Uninstall httpd but keep its dependencies | ||
+ | dnf: | ||
+ | name: httpd | ||
+ | state: absent | ||
+ | autoremove: no | ||
+ | |||
+ | - name: install a modularity appstream with defined stream and profile | ||
+ | dnf: | ||
+ | name: ' | ||
+ | state: present | ||
+ | |||
+ | - name: install a modularity appstream with defined stream | ||
+ | dnf: | ||
+ | name: ' | ||
+ | state: present | ||
+ | |||
+ | - name: install a modularity appstream with defined profile | ||
+ | dnf: | ||
+ | name: ' | ||
+ | state: present | ||
+ | |||
+ | </ | ||
===== Installation ===== | ===== Installation ===== | ||
Zeile 800: | Zeile 1087: | ||
==== RPM-Paket ansible ==== | ==== RPM-Paket ansible ==== | ||
Einen Überblick über das Paket kann man mit Hilfe des Befehls **'' | Einen Überblick über das Paket kann man mit Hilfe des Befehls **'' | ||
- | # rpm -ai ansible | + | # rpm -qi ansible |
< | < | ||
- | Version | + | Version |
- | Release | + | Release |
Architecture: | Architecture: | ||
- | Install Date: Sa 21 Dez 2019 20:38:05 CET | + | Install Date: Sa 03 Okt 2020 10:41:49 CEST |
Group : Unspecified | Group : Unspecified | ||
- | Size : 102078689 | + | Size : 102582504 |
License | License | ||
- | Signature | + | Signature |
- | Source RPM : ansible-2.9.2-1.fc31.src.rpm | + | Source RPM : ansible-2.9.13-1.fc32.src.rpm |
- | Build Date : So 08 Dez 2019 21:42:23 CET | + | Build Date : Do 03 Sep 2020 02:10:52 CEST |
- | Build Host : buildvm-aarch64-24.arm.fedoraproject.org | + | Build Host : buildvm-ppc64le-38.iad2.fedoraproject.org |
Packager | Packager | ||
Vendor | Vendor |