Ansible

Angelegt Sonntag 03 Juni 2018

Doku:
Ansible Documentation : http://docs.ansible.com/ansible/latest/index.html
ansible-playbook (CLI) : https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html
Working With Playbooks : https://docs.ansible.com/ansible/2.7/user_guide/playbooks.html
Playbook Keywords : https://docs.ansible.com/ansible/2.7/reference_appendices/playbooks_keywords.html?highlight=changed_when
Ansible-Module : https://docs.ansible.com/ansible/latest/modules/modules_by_category.html
Installation Guide : http://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html
Ansible Galaxy : https://docs.ansible.com/ansible/latest/reference_appendices/galaxy.html
Galaxy Search : https://galaxy.ansible.com/search?vendor=false&order_by=-relevance&page_size=10

Weitere Links:
Using Ansible on Ubuntu 18.04 (etwas kryptisch) : https://www.howtoforge.com/tutorial/setup-new-user-and-ssh-key-authentication-using-ansible/
How to Manage Multistage Environments with Ansible : https://www.digitalocean.com/community/tutorials/how-to-manage-multistage-environments-with-ansible
Ansible Best-Practices : https://www.serverraumgeschichten.de/2018/04/ansible-best-practices/
Playbooks In Subdirectorie : https://github.com/ansible/ansible/issues/12862


Installation
+Installation

Ansible Ad-hoc commands
http://docs.ansible.com/ansible/latest/user_guide/intro_adhoc.html
http://docs.ansible.com/ansible/latest/cli/ansible.html
ansible all -m ping : In allen Hosts das Module ping ausführen. (Ansible-Verbindungstest, kein ICMP!)
ansible all -a "hostname" : Für alle Hosts wird der Kommandoname hostname an das command-modul übergeben .
ansible all -m shell -a "hostname" : Für alle Hosts wird dem shell-Modul als Parameter das Kommando hostname übergeben.
ansible all -m shell -a "whoami" --become : Als root ausführen.
ansible all -m shell -a "whoami" -K : Eventuell notwendiges Passwort abfragen (-K).
ansible hostname -m setup : Liefert Liste der vordefinierten Variablen.

Inventory:
Build Your Inventory : https://docs.ansible.com/ansible/latest/network/getting_started/first_inventory.html
Working with Inventory : https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html

CLI Playbooks: https://docs.ansible.com/ansible/latest/cli/ansible-playbook.html
apl playbook.yaml --list-hosts --list-tasks --list-tags
apl playbook.yaml --syntax-check
list-tags
apl playbook.yaml -l subset -t tags -b -K :

Playbook Keywords: https://docs.ansible.com/ansible/2.7/reference_appendices/playbooks_keywords.html?highlight=changed_when
Conditionals, [[https://docs.ansible.com/ansible/2.4/playbooks_loops.html|Loops, ]]

Module (https://docs.ansible.com/ansible/latest/modules/modules_by_category.html):
apt, apt_key, apt-repository, authorized_key, blockinfile, command,copy, debug, file, hostname, lineinfile, package, pause, service, set_fact, stat, user

Return Values: https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html
Error handling: https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html

Ansible Galaxy
ansible-galaxy init basic : Fügt die Rolle basic zu den roles als Unterverzeichnisstruktur dazu.

blockinline : http://www.mydailytutorials.com/ansible-blockinfile-module-adding-multiple-lines/



Backlinks:
3 Networked Infrastruktur