Ansible KIT: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 1: | Zeile 1: | ||
| + | = Einführung = | ||
| + | *Ansible ist ein agentenloses Automatisierungstool, das über SSH arbeitet. | ||
| + | *Es ermöglicht eine schnelle und einfache Verwaltung mehrerer Server gleichzeitig. | ||
| + | |||
=Installation= | =Installation= | ||
*sudo apt install ansible sshpass | *sudo apt install ansible sshpass | ||
Version vom 19. März 2025, 19:40 Uhr
Einführung
- Ansible ist ein agentenloses Automatisierungstool, das über SSH arbeitet.
- Es ermöglicht eine schnelle und einfache Verwaltung mehrerer Server gleichzeitig.
Installation
- sudo apt install ansible sshpass
Verzeichnis erstellen
- mkdir -p ~/ansible
Arbeitsverzeichnis erstellen
- mkdir -p ~/ansible
- cd ~/ansible
Host Datei erstellen
- vi > ~/ansible/hosts
[it] ns ansible_host=10.88.113.21 mail ansible_host=10.88.113.3 fw ansible_host=10.88.113.1 proxy ansible_host=10.88.113.4 checkmk ansible_host=10.88.113.5 www ansible_host=10.88.113.11 revproxy ansible_host=10.88.113.41 [it:vars] ansible_user=kit ansible_password=kit ansible_become=true ansible_become_method=sudo ansible_become_password=kit ansible_ssh_common_args='-o StrictHostKeyChecking=no'
Wir pingen
- ansible all -i ~/ansible/hosts -m ping
Playbooks
- vi ~/ansible/install_ca.yml
- hosts: firewalls
gather_facts: yes
tasks:
- name: Kopiere CA-Zertifikat auf die Firewalls
copy:
src: ca.crt
dest: /usr/local/share/ca-certificates/ca.crt
owner: root
group: root
mode: "0644"
- name: Zertifikatsdatenbank aktualisieren
command: sudo update-ca-certificates
Ist ip_forward eingeschaltet?
- ansible all -i ~/ansible/hosts -a "cat /proc/sys/net/ipv4/ip_forward"