{"id":1150,"date":"2019-03-30T19:13:10","date_gmt":"2019-03-30T18:13:10","guid":{"rendered":"http:\/\/www.fotoandnet.de\/wp\/?p=1150"},"modified":"2019-03-30T19:57:22","modified_gmt":"2019-03-30T18:57:22","slug":"ansible-auf-linux-arch-installieren","status":"publish","type":"post","link":"http:\/\/www.fotoandnet.de\/wp\/?p=1150","title":{"rendered":"Ansible auf Linux Arch installieren"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Die Installation von Ansible auf Linux Arch ist weitestgehend ein No-Brainer. F\u00fcr das Ansible selber ist das Paket &#8222;ansible&#8220; notwendig. Wer, wie ich, seine Playbooks checken lassen m\u00f6chte, installiert das Paket &#8222;ansible-lint&#8220; einfach mit.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[root@barney ansible]# pacman -S ansible ansible-lint\nL\u00f6se Abh\u00e4ngigkeiten auf...\nSuche nach in Konflikt stehenden Paketen...\n\nPakete (3) python-ruamel-yaml-0.15.89-1  ansible-2.7.9-1  ansible-lint-4.1.0-1\n\nGesamtgr\u00f6\u00dfe des Downloads:            0,33 MiB\nGesamtgr\u00f6\u00dfe der installierten Pakete:  81,56 MiB\n\n:: Installation fortsetzen? [J\/n] \n:: Empfange Pakete...\n python-ruamel-yaml-0.15.89-1-x86_64                                                                                                                                  279,1 KiB  5,80M\/s 00:00 [#######################################################################################################################] 100%\n ansible-lint-4.1.0-1-any                                                                                                                                              60,9 KiB  0,00B\/s 00:00 [#######################################################################################################################] 100%\n(3\/3) Pr\u00fcfe Schl\u00fcssel im Schl\u00fcsselring                                                                                                                                                         [#######################################################################################################################] 100%\n(3\/3) \u00dcberpr\u00fcfe Paket-Integrit\u00e4t                                                                                                                                                               [#######################################################################################################################] 100%\n(3\/3) Lade Paket-Dateien                                                                                                                                                                       [#######################################################################################################################] 100%\n(3\/3) Pr\u00fcfe auf Dateikonflikte                                                                                                                                                                 [#######################################################################################################################] 100%\n(3\/3) \u00dcberpr\u00fcfe verf\u00fcgbaren Festplattenspeicher                                                                                                                                                [#######################################################################################################################] 100%\n:: Verarbeite Paket\u00e4nderungen...\n(1\/3) Installiere ansible                                                                                                                                                                      [#######################################################################################################################] 100%\nOptionale Abh\u00e4ngigkeiten f\u00fcr ansible\n    sshpass: for ssh connections with password\n    python-passlib: crypt values for vars_prompt\n    python-pyopenssl: openssl modules\n    python-netaddr: for the ipaddr filter\n    python-systemd: log to journal\n    python-pywinrm: connect to Windows machines\n    python-dnspython: for dig lookup\n    python-ovirt-engine-sdk: ovirt support\n    python-boto3: aws_s3 module\n    python-jmespath: json_query support\n    acme-tiny: openssl_certificate module\n(2\/3) Installiere python-ruamel-yaml                                                                                                                                                           [#######################################################################################################################] 100%\n(3\/3) Installiere ansible-lint                                                                                                                                                                 [#######################################################################################################################] 100%\n:: Starte post-transaction hooks...\n(1\/1) Arming ConditionNeedsUpdate...\n[root@barney ansible]# \n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Nachdem Installieren ist es wichtig seine zu managenden Nodes in der \/etc\/ansible\/hosts einzutragen oder wer eine erheblich gr\u00f6\u00dfere Infrastruktur hat, nutzt die Variante mit den Unterverzeichnissen. F\u00fcr mich reicht die Variante mit den Textdateien allemale aus. Na dann trage ich mal die Nodes ein.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[root@barney bak]# nano \/etc\/ansible\/hosts \n\n[glusterfs]\n192.168.2.143\n192.168.2.144\n192.168.2.145\n192.168.2.146\n192.168.2.25<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Damit sind die f\u00fcnf Nodes des zu bauenden GlusterFS eingetragen und ich pr\u00fcfe auch gleich mal, ob sie f\u00fcr Ansible erreichbar sind, in dem in den klassichen PING Test mache.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[ansible@barney ~]$ ansible all -m ping\n192.168.2.144 | SUCCESS => {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n192.168.2.146 | SUCCESS => {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n192.168.2.143 | SUCCESS => {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n192.168.2.145 | SUCCESS => {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n192.168.2.25 | SUCCESS => {\n    \"changed\": false,\n    \"ping\": \"pong\"\n}\n[ansible@barney ~]$ <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">L\u00e4uft ja wie geschmiert. Alle f\u00fcnf Odroid-HC2 melden sich, ergo kann sich Ansible \u00fcber SSH einloggen und Python Befehle absetzen. Dann werde ich den f\u00fcnf mal ein kleines Playbook vorspielen lassen, was sie zum Software-Update animieren sollte. Das Playbook ist ganz kurz und st\u00f6\u00dft nur lokal den Update selbst an.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[ansible@barney ~]$ cat syu.yml \n---\n- name: All hosts up-to-date\n  hosts: glusterfs\n  become: yes\n  \n  tasks:\n    - name: full system upgrade\n      pacman:\n        update_cache: yes\n        upgrade: yes\n\n[ansible@barney ~]$ <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Fertig ist das Playbook. Ich habe das Playbook einmal mittels ansible-lint gepr\u00fcft.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[ansible@barney ~]$ ansible-lint syu.yml \n[201] Trailing whitespace\nsyu.yml:5\n  \n\n[ansible@barney ~]$<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ja okay, es sind hinter dem Text tat\u00e4schlich noch Leerzeichen drin, kann ich mir verkneifen &#8211; ist aber funktional irrelevant. Na dann mal sehen, was die Nodes zu dem Playbook sagen..<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[ansible@barney ~]$ ansible-playbook syu.yml\n\nPLAY [All hosts up-to-date] ******************************************************\n\nTASK [Gathering Facts] ***********************************************************\nok: [192.168.2.146]\nok: [192.168.2.143]\nok: [192.168.2.144]\nok: [192.168.2.145]\nok: [192.168.2.25]\n\nTASK [full system upgrade] **************************************************************************************************************************************************************************************************************************************************************************************************\nchanged: [192.168.2.146]\nchanged: [192.168.2.144]\nchanged: [192.168.2.143]\nchanged: [192.168.2.145]\nchanged: [192.168.2.25]\n\nPLAY RECAP ******************************************************************************************************************************************************************************************************************************************************************************************************************\n192.168.2.143              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.144              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.145              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.146              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.25               : ok=2    changed=1    unreachable=0    failed=0   \n\n[ansible@barney ~]$ <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ich freue mich, dass alle f\u00fcnf sich neue Software geholt haben und der Software Update gut durch lief. Nat\u00fcrlich kann man da noch deutlich mehr steuern, aber f\u00fcr den ersten Test reicht mir das aus. Nach dem Software Update wollte ich auch noch probieren, ob ich alle f\u00fcnf gleichzeitig Rebooten kann. Daf\u00fcr habe ich ebenso ein Playbook geschrieben. Auch kein weltbewegendes Zeug.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[ansible@barney ~]$ cat reboot.yml \n---\n- name: All hosts reboot\n  hosts: glusterfs\n  become: yes\n  \n  tasks:\n    - name: Unconditionally reboot the machine with all defaults\n      reboot:\n\n[ansible@barney ~]$ <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Und das Playbook werfe ich jetzt den f\u00fcnf Nodes mal vor die F\u00fc\u00dfe und wenn ich das richtig Verstanden habe, rebooten alle f\u00fcnf Nodes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[ansible@barney ~]$ ansible-playbook reboot.yml \n\nPLAY [All hosts reboot] **********************************************************\n\nTASK [Gathering Facts] ***********************************************************\nok: [192.168.2.146]\nok: [192.168.2.143]\nok: [192.168.2.144]\nok: [192.168.2.145]\nok: [192.168.2.25]\n\nTASK [Unconditionally reboot the machine with all defaults] **********************\nchanged: [192.168.2.143]\nchanged: [192.168.2.145]\nchanged: [192.168.2.146]\nchanged: [192.168.2.144]\nchanged: [192.168.2.25]\n\nPLAY RECAP ***********************************************************************\n192.168.2.143              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.144              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.145              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.146              : ok=2    changed=1    unreachable=0    failed=0   \n192.168.2.25               : ok=2    changed=1    unreachable=0    failed=0   \n\n[ansible@barney ~]$ \n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Ist schon ein merkw\u00fcrdiges Gef\u00fchl, wenn da f\u00fcnf Nodes gleichzeitig rebooten und man das Anlaufen ihrer HDDs h\u00f6ren kann.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">F\u00fcr meinen ersten Ansible Test bin ich zufrieden. In dem n\u00e4chsten Beitrag werde ich mich St\u00fcck f\u00fcr St\u00fcck an das automatische Aufsetzen des GlusterFS machen. Denn wenn sp\u00e4ter weitere Nodes dazu kommen, m\u00f6chte ich das ja genau mit Playbooks ausf\u00fchren.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Die Installation von Ansible auf Linux Arch ist weitestgehend ein No-Brainer. F\u00fcr das Ansible selber ist das Paket &#8222;ansible&#8220; notwendig. Wer, wie ich, seine Playbooks checken lassen m\u00f6chte, installiert das Paket &#8222;ansible-lint&#8220; einfach mit.&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":1158,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[55,59,53,57,56,58],"class_list":["post-1150","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-ansible","tag-ansible-lint","tag-linux-arch","tag-pacman","tag-playbook","tag-reboot"],"_links":{"self":[{"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1150"}],"version-history":[{"count":6,"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1150\/revisions"}],"predecessor-version":[{"id":1160,"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1150\/revisions\/1160"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=\/wp\/v2\/media\/1158"}],"wp:attachment":[{"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1150"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.fotoandnet.de\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}