Both sides previous revision Previous revision Next revision | Previous revision |
redhat:other-redhat:ansible:start [2017/07/19 11:04] – [Schritt 4 - Abfüllen der common Rolle] michael | redhat:other-redhat:ansible:start [2020/05/13 15:01] (current) – [Next, we have a set of tasks:] michael |
---|
<WRAP left round info 100%> | <WRAP left round info 100%> |
**Weitere nützliche Informationen:** | **Weitere nützliche Informationen:** |
* [[https://sysadmincasts.com/episodes/43-19-minutes-with-ansible-part-1-4|Das Ansible Funktionsprinzip anhand eines Videos und Grafiken erklärt.]] | * **''[[https://sysadmincasts.com/episodes/43-19-minutes-with-ansible-part-1-4|Das Ansible Funktionsprinzip anhand eines Videos und Grafiken erklärt.]]''** |
</WRAP> | </WRAP> |
| |
| |
| ---- |
| |
| ====== Erste Schritte mit Ansible ====== |
| |
| <WRAP center box 100%> |
===== Installation auf CentOS / RHEL7 ===== | ===== Installation auf CentOS / RHEL7 ===== |
Installiert, wird Ansible anschliessend mit einem ganz einfachen yum install auftruf; Da die benötigten RPMs über das EPEL 6, 7, repositorie verfügbar sind. -> ([[redhat:base-redhat:repositories-redhat|EPEL Repository konfigurieren.]]) | Installiert, wird Ansible anschliessend mit einem ganz einfachen yum install auftruf; Da die benötigten RPMs über das EPEL 6, 7, repositorie verfügbar sind. -> ([[redhat:base-redhat:repositories-redhat|EPEL Repository konfigurieren.]]) |
# yum install ansible | # yum install ansible |
</code> | </code> |
| </WRAP> |
| |
---- | |
| |
====== Erste Schritte mit Ansible ====== | In den ersten Schritten, wird Ansible grundlegend Konfiguriert und erste Test-Kommandos abgesetzt! |
In den ersten Schritten, wird Ansible grundlegend Konfiguriert und erste Test-Kommandos abgesetzt! <wrap em>Wichtig:</wrap> Damit Ansible bei vorkonfigurierter SSH-Key-Authentifizierung richtig funktionieren kann, muss eine **SSH Verbindung** vom Ansibe-Host zu allen anzusprechenden Servern ohne Passwort möglich sein! Darum ist es zwingend, dass wir: <WRAP clear/> | |
| <wrap em>Wichtig:</wrap> Damit Ansible bei vorkonfigurierter SSH-Key-Authentifizierung richtig funktionieren kann, muss eine **SSH Verbindung** vom Ansibe-Host zu allen anzusprechenden Servern ohne Passwort möglich sein! Darum ist es zwingend, dass wir: <WRAP clear/> |
''**(Unter 'Key Auth.' in 'Putty Einstellungen' --> <wrap em>Agent-Forewarding aktivieren!</wrap>)**'' | ''**(Unter 'Key Auth.' in 'Putty Einstellungen' --> <wrap em>Agent-Forewarding aktivieren!</wrap>)**'' |
| |
Falls überprüft werden soll, ob man auf den geplanten Zielsystemen auch wirklich root-Zugriffe hat; kann man dies mit folgendem Befehl überprüfen: | Falls überprüft werden soll, ob man auf den geplanten Zielsystemen auch wirklich root-Zugriffe hat; kann man dies mit folgendem Befehl überprüfen: |
| |
<sxh bash; gutter: false; highlight: [1]> | <WRAP center box 100%> |
| <code> |
[rebermi@vstif2 ~]$ ansible all -s -m shell -a id | [rebermi@vstif2 ~]$ ansible all -s -m shell -a id |
| </code> |
| |
| <sxh bash; gutter: false;> |
vstif1.pnet.ch | SUCCESS | rc=0 >> | vstif1.pnet.ch | SUCCESS | rc=0 >> |
uid=0(root) gid=0(root) groups=0(root) | uid=0(root) gid=0(root) groups=0(root) |
</sxh> | </sxh> |
| </WRAP> |
| |
| |
===== Der Aufbau von einfachen Playbooks ===== | ===== Der Aufbau von einfachen Playbooks ===== |
</code> | </code> |
| |
This module allows us to specify a package and the state that it should be in, which is "installed" in our case. The ''update-cache=true'' part tells our remote machine to update its package cache //(apt-get update)// prior to installing the software. | This module allows us to specify a package and the state that it should be in, which is "installed" in our case. The ''update_cache=true'' part tells our remote machine to update its package cache //(apt-get update)// prior to installing the software. |
| |
The "**notify**" item contains a list with one item, which is called "start nginx". This is not an internal Ansible command, it is a reference to a handler, which can perform certain functions when it is called from within a task. //We will define the "start nginx" handler below.// | The "**notify**" item contains a list with one item, which is called "start nginx". This is not an internal Ansible command, it is a reference to a handler, which can perform certain functions when it is called from within a task. //We will define the "start nginx" handler below.// |
Für unser Beispiel, werden wir in einem separaten Ordner unsere Variablen definieren, drei unterschiedliche Rollen erstellen und Konfigurationstemplates zu einzelnen Pakete vordefinieren. Unsere fertige Struktur, sollte nach unserer Arbeit in etwa so aussehen: | Für unser Beispiel, werden wir in einem separaten Ordner unsere Variablen definieren, drei unterschiedliche Rollen erstellen und Konfigurationstemplates zu einzelnen Pakete vordefinieren. Unsere fertige Struktur, sollte nach unserer Arbeit in etwa so aussehen: |
| |
<sxh bash> | <sxh bash; gutter: false;> |
. | . |
├── deploy-lamp.yml | ├── deploy-lamp.yml |
//Dieses Kommando legt uns nun folgende Ordnungsstruktur an:// | //Dieses Kommando legt uns nun folgende Ordnungsstruktur an:// |
| |
<sxh bash> | <sxh bash; gutter: false;> |
roles/ | roles/ |
├── common | ├── common |
<WRAP center round download 100%> | <WRAP center round download 100%> |
==== Fertige Playbooks zum Download ==== | ==== Fertige Playbooks zum Download ==== |
Unter dem unten aufgeführten Link, werden von Ansible unteranderem bereits fertige Playbooks, zu folgenden Themen zum Download angeboten: -> ''[[https://github.com/ansible/ansible-examples/tree/master/jboss-standalone|jboss-standolone]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/lamp_simple_rhel7|lamp_simple_rhel7]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/mongodb|mongodb]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/mongodb|tomcat-standalone]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/wordpress-nginx_rhel7|wordpress-nginx-rhel7]]'' und viele mehr. | ''Unter dem unten aufgeführten Link, werden von Ansible unteranderem bereits fertige Playbooks, zu folgenden Themen zum Download angeboten:'' -> ''[[https://github.com/ansible/ansible-examples/tree/master/jboss-standalone|jboss-standolone]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/lamp_simple_rhel7|lamp_simple_rhel7]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/mongodb|mongodb]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/mongodb|tomcat-standalone]]'', ''[[https://github.com/ansible/ansible-examples/tree/master/wordpress-nginx_rhel7|wordpress-nginx-rhel7]] und viele mehr.'' |
| |
* ''GitHub Link -> https://github.com/ansible/ansible-examples'' | * ''GitHub Link -> https://github.com/ansible/ansible-examples'' |
* https://nsrc.org/workshops/2015/rwnog/raw-attachment/wiki/Track2Agenda/first-playbook.htm | * https://nsrc.org/workshops/2015/rwnog/raw-attachment/wiki/Track2Agenda/first-playbook.htm |
* https://cloudacademy.com/blog/building-ansible-playbooks-step-by-step/ | * https://cloudacademy.com/blog/building-ansible-playbooks-step-by-step/ |
| * https://www.tecmint.com/install-and-configure-ansible-automation-tool-in-linux/ |
| |
---- | ---- |
* [[http://docs.ansible.com/ansible/list_of_web_infrastructure_modules.html|Web Infrastructure Modules]] | * [[http://docs.ansible.com/ansible/list_of_web_infrastructure_modules.html|Web Infrastructure Modules]] |
* [[http://docs.ansible.com/ansible/list_of_windows_modules.html|Windows Modules]] | * [[http://docs.ansible.com/ansible/list_of_windows_modules.html|Windows Modules]] |
| |
| |
| |
| |
| |
---- | ---- |
| |
| |
| |
| |
| |
===== Weiteres ===== | ===== Weiteres ===== |