Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung |
tachtler:ansible [2019/12/23 09:05] – [sudoers.yml] klaus | tachtler:ansible [2020/03/27 08:16] (aktuell) – [CentOS] klaus |
---|
| |
===== Installation ===== | ===== Installation ===== |
| |
| ==== CentOS ==== |
| |
Zur Installation von [[https://www.ansible.com/|Ansible]] wird nachfolgendes Paket benötigt: | Zur Installation von [[https://www.ansible.com/|Ansible]] wird nachfolgendes Paket benötigt: |
* **''ansible''** - ist im ''epel''-Repository des Drittanbieters [[https://fedoraproject.org/wiki/EPEL|EPEL]] enthalten | * **''ansible''** - ist im ''epel''-Repository des Drittanbieters [[https://fedoraproject.org/wiki/EPEL|EPEL]] enthalten |
| * **''policycoreutils-python-utils''** - ist im ''BaseOS''-Repository enthalten - und ist erforderlich, wenn **SELinux**-Konfigurationen in **Playbooks** durchgeführt werden sollen. |
| |
Mit nachfolgendem Befehl, wird das Pakete **''ansible''** installiert: | Mit nachfolgendem Befehl, wird das Pakete **''ansible''** installiert: |
</code> | </code> |
| |
Mit nachfolgendem Befehl kann überprüft werden, welche Inhalte mit den Paket **''ansible''** installiert wurden. | Mit nachfolgendem Befehl kann überprüft werden, welche Inhalte mit dem Paket **''ansible''** installiert wurden. |
<code> | <code> |
# rpm -qil ansible | # rpm -qil ansible |
/usr/bin/ansible-vault | /usr/bin/ansible-vault |
... | ... |
| </code> |
| |
| Mit nachfolgendem Befehl, wird das Pakete **''policycoreutils-python-utils''** installiert: |
| <code> |
| # dnf install policycoreutils-python-utils |
| Last metadata expiration check: 0:05:29 ago on Fri 27 Mar 2020 08:05:25 AM CET. |
| Dependencies resolved. |
| ================================================================================ |
| Package Arch Version Repo Size |
| ================================================================================ |
| Installing: |
| policycoreutils-python-utils |
| noarch 2.9-3.el8_1.1 BaseOS 250 k |
| Installing dependencies: |
| checkpolicy x86_64 2.9-1.el8 BaseOS 348 k |
| python3-audit x86_64 3.0-0.10.20180831git0047a6c.el8 BaseOS 85 k |
| python3-libsemanage x86_64 2.9-1.el8 BaseOS 127 k |
| python3-policycoreutils noarch 2.9-3.el8_1.1 BaseOS 2.2 M |
| python3-setools x86_64 4.2.2-1.el8 BaseOS 600 k |
| |
| Transaction Summary |
| ================================================================================ |
| Install 6 Packages |
| |
| Total download size: 3.6 M |
| Installed size: 11 M |
| Is this ok [y/N]: y |
| Downloading Packages: |
| (1/6): python3-audit-3.0-0.10.20180831git0047a6 43 kB/s | 85 kB 00:01 |
| (2/6): python3-libsemanage-2.9-1.el8.x86_64.rpm 302 kB/s | 127 kB 00:00 |
| (3/6): policycoreutils-python-utils-2.9-3.el8_1 98 kB/s | 250 kB 00:02 |
| (4/6): checkpolicy-2.9-1.el8.x86_64.rpm 128 kB/s | 348 kB 00:02 |
| (5/6): python3-setools-4.2.2-1.el8.x86_64.rpm 548 kB/s | 600 kB 00:01 |
| (6/6): python3-policycoreutils-2.9-3.el8_1.1.no 891 kB/s | 2.2 MB 00:02 |
| -------------------------------------------------------------------------------- |
| Total 665 kB/s | 3.6 MB 00:05 |
| Running transaction check |
| Transaction check succeeded. |
| Running transaction test |
| Transaction test succeeded. |
| Running transaction |
| Preparing : 1/1 |
| Installing : python3-setools-4.2.2-1.el8.x86_64 1/6 |
| Installing : python3-libsemanage-2.9-1.el8.x86_64 2/6 |
| Installing : python3-audit-3.0-0.10.20180831git0047a6c.el8.x86_64 3/6 |
| Installing : checkpolicy-2.9-1.el8.x86_64 4/6 |
| Installing : python3-policycoreutils-2.9-3.el8_1.1.noarch 5/6 |
| Installing : policycoreutils-python-utils-2.9-3.el8_1.1.noarch 6/6 |
| Running scriptlet: policycoreutils-python-utils-2.9-3.el8_1.1.noarch 6/6 |
| Verifying : checkpolicy-2.9-1.el8.x86_64 1/6 |
| Verifying : policycoreutils-python-utils-2.9-3.el8_1.1.noarch 2/6 |
| Verifying : python3-audit-3.0-0.10.20180831git0047a6c.el8.x86_64 3/6 |
| Verifying : python3-libsemanage-2.9-1.el8.x86_64 4/6 |
| Verifying : python3-policycoreutils-2.9-3.el8_1.1.noarch 5/6 |
| Verifying : python3-setools-4.2.2-1.el8.x86_64 6/6 |
| |
| Installed: |
| policycoreutils-python-utils-2.9-3.el8_1.1.noarch |
| checkpolicy-2.9-1.el8.x86_64 |
| python3-audit-3.0-0.10.20180831git0047a6c.el8.x86_64 |
| python3-libsemanage-2.9-1.el8.x86_64 |
| python3-policycoreutils-2.9-3.el8_1.1.noarch |
| python3-setools-4.2.2-1.el8.x86_64 |
| |
| Complete! |
| </code> |
| |
| Mit nachfolgendem Befehl kann überprüft werden, welche Inhalte mit dem Paket **''policycoreutils-python-utils''** installiert wurden. |
| <code> |
| # rpm -qil policycoreutils-python-utils |
| Name : policycoreutils-python-utils |
| Version : 2.9 |
| Release : 3.el8_1.1 |
| Architecture: noarch |
| Install Date: Fri 27 Mar 2020 08:11:05 AM CET |
| Group : Unspecified |
| Size : 139789 |
| License : GPLv2 |
| Signature : RSA/SHA256, Wed 05 Feb 2020 01:09:20 AM CET, Key ID 05b555b38483c65d |
| Source RPM : policycoreutils-2.9-3.el8_1.1.src.rpm |
| Build Date : Tue 04 Feb 2020 08:03:14 PM CET |
| Build Host : aah11.rdu2.centos.org |
| Relocations : (not relocatable) |
| Packager : CentOS Buildsys <bugs@centos.org> |
| Vendor : CentOS |
| URL : https://github.com/SELinuxProject/selinux |
| Summary : SELinux policy core python utilities |
| Description : |
| The policycoreutils-python-utils package contains the management tools use to manage |
| an SELinux environment. |
| /etc/dbus-1/system.d/org.selinux.conf |
| /usr/bin/audit2allow |
| /usr/bin/audit2why |
| /usr/bin/chcat |
| /usr/bin/sandbox |
| /usr/sbin/semanage |
| /usr/share/bash-completion/completions/semanage |
| /usr/share/man/man1/audit2allow.1.gz |
| /usr/share/man/man1/audit2why.1.gz |
| /usr/share/man/man8/chcat.8.gz |
| /usr/share/man/man8/sandbox.8.gz |
| /usr/share/man/man8/semanage-boolean.8.gz |
| /usr/share/man/man8/semanage-dontaudit.8.gz |
| /usr/share/man/man8/semanage-export.8.gz |
| /usr/share/man/man8/semanage-fcontext.8.gz |
| /usr/share/man/man8/semanage-ibendport.8.gz |
| /usr/share/man/man8/semanage-ibpkey.8.gz |
| /usr/share/man/man8/semanage-import.8.gz |
| /usr/share/man/man8/semanage-interface.8.gz |
| /usr/share/man/man8/semanage-login.8.gz |
| /usr/share/man/man8/semanage-module.8.gz |
| /usr/share/man/man8/semanage-node.8.gz |
| /usr/share/man/man8/semanage-permissive.8.gz |
| /usr/share/man/man8/semanage-port.8.gz |
| /usr/share/man/man8/semanage-user.8.gz |
| /usr/share/man/man8/semanage.8.gz |
| /usr/share/man/ru/man1/audit2allow.1.gz |
| /usr/share/man/ru/man1/audit2why.1.gz |
| /usr/share/man/ru/man8/chcat.8.gz |
| /usr/share/man/ru/man8/sandbox.8.gz |
| /usr/share/man/ru/man8/semanage-boolean.8.gz |
| /usr/share/man/ru/man8/semanage-dontaudit.8.gz |
| /usr/share/man/ru/man8/semanage-export.8.gz |
| /usr/share/man/ru/man8/semanage-fcontext.8.gz |
| /usr/share/man/ru/man8/semanage-ibendport.8.gz |
| /usr/share/man/ru/man8/semanage-ibpkey.8.gz |
| /usr/share/man/ru/man8/semanage-import.8.gz |
| /usr/share/man/ru/man8/semanage-interface.8.gz |
| /usr/share/man/ru/man8/semanage-login.8.gz |
| /usr/share/man/ru/man8/semanage-module.8.gz |
| /usr/share/man/ru/man8/semanage-node.8.gz |
| /usr/share/man/ru/man8/semanage-permissive.8.gz |
| /usr/share/man/ru/man8/semanage-port.8.gz |
| /usr/share/man/ru/man8/semanage-user.8.gz |
| /usr/share/man/ru/man8/semanage.8.gz |
</code> | </code> |
| |
executable location = /usr/bin/ansible | executable location = /usr/bin/ansible |
python version = 3.6.8 (default, Oct 7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] | python version = 3.6.8 (default, Oct 7 2019, 17:58:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] |
| </code> |
| |
| ==== ArchLinux ==== |
| |
| Mit nachfolgendem Befehl, wird das Pakete **''ansible''** installiert: |
| <code> |
| # pacman -S ansible --noconfirm |
| resolving dependencies... |
| looking for conflicting packages... |
| |
| Packages (24) libnsl-1.2.0-2 libsodium-1.0.18-1 libyaml-0.2.2-1 |
| python-3.8.1-1 python-appdirs-1.4.3-5 python-asn1crypto-1.2.0-3 |
| python-bcrypt-3.1.7-3 python-cffi-1.13.2-2 |
| python-cryptography-2.8-1 python-idna-2.8-3 |
| python-jinja-2.10.3-3 python-markupsafe-1.1.1-3 |
| python-ordered-set-3.1.1-1 python-packaging-19.2-5 |
| python-paramiko-2.6.0-3 python-ply-3.11-4 python-pyasn1-0.4.8-1 |
| python-pycparser-2.19-3 python-pynacl-1.3.0-3 |
| python-pyparsing-2.4.6-1 python-setuptools-1:43.0.0-1 |
| python-six-1.13.0-2 python-yaml-5.1.2-3 ansible-2.9.2-1 |
| |
| Total Download Size: 52.42 MiB |
| Total Installed Size: 307.49 MiB |
| |
| :: Proceed with installation? [Y/n] |
| :: Retrieving packages... |
| libnsl-1.2.0-2-x... 57.4 KiB 660 KiB/s 00:00 [######################] 100% |
| python-3.8.1-1-x... 37.2 MiB 1294 KiB/s 00:29 [######################] 100% |
| libyaml-0.2.2-1-... 54.7 KiB 1656 KiB/s 00:00 [######################] 100% |
| python-ply-3.11-... 73.3 KiB 1559 KiB/s 00:00 [######################] 100% |
| python-pycparser... 164.2 KiB 1493 KiB/s 00:00 [######################] 100% |
| python-cffi-1.13... 210.1 KiB 1501 KiB/s 00:00 [######################] 100% |
| python-six-1.13.... 20.9 KiB 1496 KiB/s 00:00 [######################] 100% |
| python-idna-2.8-... 66.4 KiB 1443 KiB/s 00:00 [######################] 100% |
| python-appdirs-1... 14.2 KiB 2033 KiB/s 00:00 [######################] 100% |
| python-pyparsing... 110.4 KiB 1512 KiB/s 00:00 [######################] 100% |
| python-packaging... 38.9 KiB 1692 KiB/s 00:00 [######################] 100% |
| python-ordered-s... 12.5 KiB 959 KiB/s 00:00 [######################] 100% |
| python-setuptool... 296.1 KiB 1410 KiB/s 00:00 [######################] 100% |
| python-asn1crypt... 163.9 KiB 1490 KiB/s 00:00 [######################] 100% |
| python-cryptogra... 340.7 KiB 1420 KiB/s 00:00 [######################] 100% |
| python-pyasn1-0.... 108.2 KiB 1546 KiB/s 00:00 [######################] 100% |
| python-markupsaf... 22.4 KiB 1320 KiB/s 00:00 [######################] 100% |
| python-yaml-5.1.... 177.2 KiB 1441 KiB/s 00:00 [######################] 100% |
| python-bcrypt-3.... 30.1 KiB 1309 KiB/s 00:00 [######################] 100% |
| libsodium-1.0.18... 158.6 KiB 1482 KiB/s 00:00 [######################] 100% |
| python-pynacl-1.... 76.1 KiB 1522 KiB/s 00:00 [######################] 100% |
| python-paramiko-... 247.7 KiB 1424 KiB/s 00:00 [######################] 100% |
| python-jinja-2.1... 199.2 KiB 1364 KiB/s 00:00 [######################] 100% |
| ansible-2.9.2-1-any 12.7 MiB 1342 KiB/s 00:10 [######################] 100% |
| (24/24) checking keys in keyring [######################] 100% |
| (24/24) checking package integrity [######################] 100% |
| (24/24) loading package files [######################] 100% |
| (24/24) checking for file conflicts [######################] 100% |
| (24/24) checking available disk space [######################] 100% |
| :: Processing package changes... |
| ( 1/24) installing libnsl [######################] 100% |
| ( 2/24) installing python [######################] 100% |
| Optional dependencies for python |
| python-setuptools [pending] |
| python-pip |
| sqlite [installed] |
| mpdecimal: for decimal |
| xz: for lzma [installed] |
| tk: for tkinter |
| ( 3/24) installing libyaml [######################] 100% |
| ( 4/24) installing python-yaml [######################] 100% |
| ( 5/24) installing python-ply [######################] 100% |
| ( 6/24) installing python-pycparser [######################] 100% |
| ( 7/24) installing python-cffi [######################] 100% |
| ( 8/24) installing python-six [######################] 100% |
| ( 9/24) installing python-bcrypt [######################] 100% |
| (10/24) installing python-idna [######################] 100% |
| (11/24) installing python-appdirs [######################] 100% |
| (12/24) installing python-pyparsing [######################] 100% |
| (13/24) installing python-packaging [######################] 100% |
| (14/24) installing python-ordered-set [######################] 100% |
| (15/24) installing python-setuptools [######################] 100% |
| (16/24) installing python-asn1crypto [######################] 100% |
| (17/24) installing python-cryptography [######################] 100% |
| (18/24) installing python-pyasn1 [######################] 100% |
| (19/24) installing libsodium [######################] 100% |
| (20/24) installing python-pynacl [######################] 100% |
| (21/24) installing python-paramiko [######################] 100% |
| (22/24) installing python-markupsafe [######################] 100% |
| (23/24) installing python-jinja [######################] 100% |
| Optional dependencies for python-jinja |
| python-babel: for i18n support |
| (24/24) installing ansible [######################] 100% |
| Optional dependencies for ansible |
| sshpass: for ssh connections with password |
| python-passlib: crypt values for vars_prompt |
| python-pyopenssl: openssl modules |
| python-netaddr: for the ipaddr filter |
| python-systemd: log to journal |
| python-pywinrm: connect to Windows machines |
| python-dnspython: for dig lookup |
| python-ovirt-engine-sdk: ovirt support |
| python-boto3: aws_s3 module |
| python-jmespath: json_query support |
| acme-tiny: openssl_certificate module |
| :: Running post-transaction hooks... |
| (1/1) Arming ConditionNeedsUpdate... |
| </code> |
| |
| Mit nachfolgendem Befehl kann überprüft werden, welche Inhalte mit dem Paket **''ansible''** installiert wurden. |
| <code> |
| # pacman -Ql ansible |
| ansible /etc/ |
| ansible /etc/ansible/ |
| ansible /etc/ansible/ansible.cfg |
| ansible /usr/ |
| ansible /usr/bin/ |
| ansible /usr/bin/ansible |
| ansible /usr/bin/ansible-config |
| ansible /usr/bin/ansible-connection |
| ansible /usr/bin/ansible-console |
| ansible /usr/bin/ansible-doc |
| ansible /usr/bin/ansible-galaxy |
| ansible /usr/bin/ansible-inventory |
| ansible /usr/bin/ansible-playbook |
| ansible /usr/bin/ansible-pull |
| ansible /usr/bin/ansible-test |
| ansible /usr/bin/ansible-vault |
| ansible /usr/lib/ |
| ansible /usr/lib/python3.8/ |
| ... |
| [Kürzung der Ausgabe] |
| ... |
| ansible /usr/share/ |
| ansible /usr/share/ansible/ |
| ansible /usr/share/ansible/doc/ |
| ansible /usr/share/ansible/doc/examples/ |
| ansible /usr/share/ansible/doc/examples/ansible.cfg |
| ansible /usr/share/ansible/doc/examples/hosts |
| ansible /usr/share/ansible/doc/examples/scripts/ |
| ansible /usr/share/ansible/doc/examples/scripts/ConfigureRemotingForAnsible.ps1 |
| ansible /usr/share/ansible/doc/examples/scripts/upgrade_to_ps3.ps1 |
| ansible /usr/share/doc/ |
| ansible /usr/share/doc/ansible/ |
| ansible /usr/share/doc/ansible/COPYING |
| ansible /usr/share/man/ |
| ansible /usr/share/man/man1/ |
| ansible /usr/share/man/man1/ansible-config.1.gz |
| ansible /usr/share/man/man1/ansible-console.1.gz |
| ansible /usr/share/man/man1/ansible-doc.1.gz |
| ansible /usr/share/man/man1/ansible-galaxy.1.gz |
| ansible /usr/share/man/man1/ansible-inventory.1.gz |
| ansible /usr/share/man/man1/ansible-playbook.1.gz |
| ansible /usr/share/man/man1/ansible-pull.1.gz |
| ansible /usr/share/man/man1/ansible-vault.1.gz |
| ansible /usr/share/man/man1/ansible.1.gz |
| </code> |
| |
| Zum Abschluss kann mit nachfolgendem Befehl überprüft werden, ob ein Aufruf möglich ist und [[https://www.ansible.com/|Ansible]] nutzbar ist: |
| <code> |
| # ansible --version |
| ansible 2.9.2 |
| config file = /etc/ansible/ansible.cfg |
| configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] |
| ansible python module location = /usr/lib/python3.8/site-packages/ansible |
| executable location = /usr/bin/ansible |
| python version = 3.8.1 (default, Dec 21 2019, 20:57:38) [GCC 9.2.0] |
</code> | </code> |
| |
===== Vorbereitung ===== | ===== Vorbereitung ===== |
| |
| :!: **HINWEIS** - **Nachfolgende Schritte sind __NICHT__ mehr durchzuführen, wenn die Installation wie unter nachfolgendem internen Link fortgesetzte werden soll:** |
| * [[tachtler:ansible_mit_ansible_einrichten|Ansible mit Ansible einrichten]] |
| |
Für die spätere Kommunikation via **SSH**, kann mit nachfolgendem Befehl ein **SSH-Schlüsselpaar** erzeugt werden, welches dann später zur Anmeldung an den entsprechenden Servern verwendet werden kann. | Für die spätere Kommunikation via **SSH**, kann mit nachfolgendem Befehl ein **SSH-Schlüsselpaar** erzeugt werden, welches dann später zur Anmeldung an den entsprechenden Servern verwendet werden kann. |
* <code>-a 97</code> | * <code>-a 97</code> |
| |
''-a rounds'' - Beim Speichern eines privaten Schlüssels gibt diese Option die Anzahl der KDF (Schlüsselableitungsfunktion) verwendeten Runden. Höhere Zahlen ergeben langsamere "Passphrasenüberprüfung" und erhöhte Widerstandsfähigkeit gegen das Knacken des Passworts erzwingen (falls die Schlüssel gestohlen werden). | ''-a rounds'' - Beim Speichern eines privaten Schlüssels gibt diese Option die Anzahl der KDF (Schlüsselableitungsfunktion) verwendeten Runden an. Höhere Zahlen ergeben langsamere "Passphrasenüberprüfung" und erhöhte Widerstandsfähigkeit gegen das Knacken des Passworts erzwingen (falls die Schlüssel gestohlen werden). |
| |
Bei der Überprüfung von DH-GEX-Kandidaten (mit dem Befehl ''-T''). Diese Option gibt die Anzahl der durchzuführenden Primzahltests an. | Bei der Überprüfung von DH-GEX-Kandidaten (mit dem Befehl ''-T''). Diese Option gibt die Anzahl der durchzuführenden Primzahltests an. |
- **''become_method=sudo''** - welcher **Befehl** zur Rechteerlangung ausgeführt werden soll | - **''become_method=sudo''** - welcher **Befehl** zur Rechteerlangung ausgeführt werden soll |
- **''become_user=root''** - der **Benutzer**, dessen Rechte erlangt werden sollen | - **''become_user=root''** - der **Benutzer**, dessen Rechte erlangt werden sollen |
- **''become_ask_pass=False''** - ob nach einem **Passwort** gefragt werden soll | - **''become_ask_pass=True''** - ob nach einem **Passwort** gefragt werden soll |
| |
Nachfolgende Änderungen sind dafür durchzuführen. | Nachfolgende Änderungen sind dafür durchzuführen. |
become_method=sudo | become_method=sudo |
become_user=root | become_user=root |
become_ask_pass=False | become_ask_pass=True |
</code> | </code> |
| |
- Für den Benutzer **''klaus''** | - Für den Benutzer **''klaus''** |
- überprüfen, ob eine Gruppe **''wheel''** existiert und | - überprüfen, ob eine Gruppe **''wheel''** existiert und |
- in einer **__neuen__** Datei **''/etc/sudoers.d/020_nopasswd_all_for_wheel''** den Eintrag **''%wheel ALL=(ALL) NOPASSWD: ALL''** vorhalten | - **__optional__** - in einer **__neuen__** Datei **''/etc/sudoers.d/020_nopasswd_all_for_wheel''** den Eintrag **''%wheel ALL=(ALL) NOPASSWD: ALL''** vorhalten |
- dies zu **''validieren''** und | - dies zu **''validieren''** und |
- den Benutzer **''klaus''** **__zusätzlich__** in die Gruppe **''wheels''** aufzunehmen und | - den Benutzer **''klaus''** **__zusätzlich__** in die Gruppe **''wheels''** aufzunehmen und |
umzusetzen. | umzusetzen. |
| |
:!: **WICHTIG** - **Durch die Aufnhame eines Benutzers, hier ''klaus'', in die Gruppe ''wheel'' erhält dieser die Möglichkeit, nach einer erfolgreichen Anmeldung am jeweiligen Server, ''sudo'' (das Wechseln auf den Benutzer ''root'', bzw. Erlangung dessen Rechte) __ohne__ Passworteingabe zu erlangen!** | :!: **WICHTIG** - **Durch die Aufnahme eines Benutzers, hier ''klaus'', in die Gruppe ''wheel'' erhält dieser die Möglichkeit, nach einer erfolgreichen Anmeldung am jeweiligen Server, ''sudo'' (das Wechseln auf den Benutzer ''root'', bzw. Erlangung dessen Rechte) __optional__ - __ohne__ Passworteingabe zu erlangen!** |
| |
:!: **WICHTIG** - Damit kann nun ermöglicht werden, dass der Benutzer, hier **''klaus''**, sich auf einem Server via **SSH-Schlüssel** verbinden kann **__und__** Befehle auf dem jeweiligen Server ausführen kann, **__auch__** mit Rechten des Benutzers **''root''** via **''sudo''**. | :!: **WICHTIG** - Damit kann nun ermöglicht werden, dass der Benutzer, hier **''klaus''**, sich auf einem Server via **SSH-Schlüssel** verbinden kann **__und__** Befehle auf dem jeweiligen Server ausführen kann, **__auch__** mit Rechten des Benutzers **''root''** via **''sudo''**. |
* [[https://docs.ansible.com/ansible/2.8/user_guide/intro_getting_started.html#remote-connection-information|Ansible - Docs » User Guide » Getting Started - Remote Connection Information]] | * [[https://docs.ansible.com/ansible/2.8/user_guide/intro_getting_started.html#remote-connection-information|Ansible - Docs » User Guide » Getting Started - Remote Connection Information]] |
| |
* **„Zitat“** - „[[https://www.ansible.com/|Ansible]] stellt keinen Kanal zur Verfügung, der die Kommunikation zwischen dem Benutzer und dem ssh-Prozess erlaubt, um ein Passwort manuell zu akzeptieren und einen ssh-Schlüssel zu entschlüsseln, wenn das ssh-Verbindungs-Plugin verwendet wird (was der Standard ist). Die Verwendung des ''ssh-agent'' wird dringend empfohlen.“ | * **„Zitat“** - „[[https://www.ansible.com/|Ansible]] stellt keinen Kanal zur Verfügung, der die Kommunikation zwischen dem Benutzer und dem SSH-Prozess erlaubt, um ein Passwort manuell zu akzeptieren und einen SSH-Schlüssel zu entschlüsseln, wenn das SSH-Verbindungs-Plugin verwendet wird (was der Standard ist). Die Verwendung des ''ssh-agent'' wird dringend empfohlen.“ |
| |
=== Playbook === | === Playbook === |
name: wheel | name: wheel |
state: present | state: present |
| |
- name: Allow 'wheel' group to have passwordless sudo | # Tachtler - optional - |
copy: | # - name: Allow 'wheel' group to have passwordless sudo |
content: '%wheel ALL=(ALL) NOPASSWD: ALL' | # copy: |
dest: /etc/sudoers.d/020_nopasswd_all_for_wheel | # content: '%wheel ALL=(ALL) NOPASSWD: ALL' |
owner: root | # dest: /etc/sudoers.d/020_nopasswd_all_for_wheel |
group: root | # owner: root |
mode: "0440" | # group: root |
validate: visudo -cf %s | # mode: "0440" |
| # validate: visudo -cf %s |
| |
- name: Add sudoers users to 'wheel' group | - name: Add sudoers users to 'wheel' group |
ok: [192.168.122.56] => {"changed": false, "gid": 10, "name": "wheel", "state": "present", "system": false} | ok: [192.168.122.56] => {"changed": false, "gid": 10, "name": "wheel", "state": "present", "system": false} |
ok: [192.168.122.66] => {"changed": false, "gid": 10, "name": "wheel", "state": "present", "system": false} | ok: [192.168.122.66] => {"changed": false, "gid": 10, "name": "wheel", "state": "present", "system": false} |
| |
TASK [Allow 'wheel' group to have passwordless sudo] *************************** | |
changed: [192.168.122.66] => {"changed": true, "checksum": "9126b009e0fddb335198d18b659e74dec53c424a", "dest": "/etc/sudoers.d/020_nopasswd_all_for_wheel", "gid": 0, "group": "root", "md5sum": "c06c2d51d25ed9166e144784184f255e", "mode": "0440", "owner": "root", "secontext": "system_u:object_r:etc_t:s0", "size": 30, "src": "/root/.ansible/tmp/ansible-tmp-1576998131.3731375-95829877727566/source", "state": "file", "uid": 0} | |
changed: [192.168.122.56] => {"changed": true, "checksum": "9126b009e0fddb335198d18b659e74dec53c424a", "dest": "/etc/sudoers.d/020_nopasswd_all_for_wheel", "gid": 0, "group": "root", "md5sum": "c06c2d51d25ed9166e144784184f255e", "mode": "0440", "owner": "root", "secontext": "system_u:object_r:etc_t:s0", "size": 30, "src": "/root/.ansible/tmp/ansible-tmp-1576998131.3882668-104377278500887/source", "state": "file", "uid": 0} | |
| |
TASK [Add sudoers users to 'wheel' group] ************************************** | TASK [Add sudoers users to 'wheel' group] ************************************** |
| |
PLAY RECAP ********************************************************************* | PLAY RECAP ********************************************************************* |
192.168.122.56 : ok=5 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 | 192.168.122.56 : ok=4 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
192.168.122.66 : ok=5 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 | 192.168.122.66 : ok=4 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
| |
</code> | </code> |
* [[https://docs.ansible.com/ansible/2.8/user_guide/intro_getting_started.html#remote-connection-information|Ansible - Docs » User Guide » Getting Started - Remote Connection Information]] | * [[https://docs.ansible.com/ansible/2.8/user_guide/intro_getting_started.html#remote-connection-information|Ansible - Docs » User Guide » Getting Started - Remote Connection Information]] |
| |
* **„Zitat“** - „[[https://www.ansible.com/|Ansible]] stellt keinen Kanal zur Verfügung, der die Kommunikation zwischen dem Benutzer und dem ssh-Prozess erlaubt, um ein Passwort manuell zu akzeptieren und einen ssh-Schlüssel zu entschlüsseln, wenn das ssh-Verbindungs-Plugin verwendet wird (was der Standard ist). Die Verwendung des ''ssh-agent'' wird dringend empfohlen.“ | * **„Zitat“** - „[[https://www.ansible.com/|Ansible]] stellt keinen Kanal zur Verfügung, der die Kommunikation zwischen dem Benutzer und dem SSH-Prozess erlaubt, um ein Passwort manuell zu akzeptieren und einen SSH-Schlüssel zu entschlüsseln, wenn das SSH-Verbindungs-Plugin verwendet wird (was der Standard ist). Die Verwendung des ''ssh-agent'' wird dringend empfohlen.“ |
| |
<code> | <code> |
| |
:!: **HINWEIS** - **Die Ausführungen der Befehle erfolgen als angemeldeter Benutzer ''klaus''** | :!: **HINWEIS** - **Die Ausführungen der Befehle erfolgen als angemeldeter Benutzer ''klaus''** |
| |
| :!: **HINWEIS** - **Das ''BECOME password:'' ist das des Benutzers ''klaus''** |
| |
Durch den erneuten Aufruf des nachfolgenden Befehls, kann überprüft werden, ob alle Server via **''SSH''** erreichbar sind: | Durch den erneuten Aufruf des nachfolgenden Befehls, kann überprüft werden, ob alle Server via **''SSH''** erreichbar sind: |
<code ini> | <code ini> |
$ ansible all -m ping | $ ansible all -m ping |
| BECOME password: |
192.168.122.66 | SUCCESS => { | 192.168.122.66 | SUCCESS => { |
"ansible_facts": { | "ansible_facts": { |
Ein weiterer Test könnte ebenfalls wiederholt werden, um bestätigen zu können, das auch Befehle auf den entsprechenden Server ausgeführt werden können, wie nachfolgender Befehl zeigt: | Ein weiterer Test könnte ebenfalls wiederholt werden, um bestätigen zu können, das auch Befehle auf den entsprechenden Server ausgeführt werden können, wie nachfolgender Befehl zeigt: |
<code ini> | <code ini> |
$ ansible all -a "/bin/echo hello" | $ ansible all -a "/bin/echo hello" |
| BECOME password: |
192.168.122.66 | CHANGED | rc=0 >> | 192.168.122.66 | CHANGED | rc=0 >> |
hello | hello |
<code ini> | <code ini> |
$ ansible all -a "ls /root" | $ ansible all -a "ls /root" |
| BECOME password: |
192.168.122.66 | CHANGED | rc=0 >> | 192.168.122.66 | CHANGED | rc=0 >> |
anaconda-ks.cfg | anaconda-ks.cfg |