Loading...
 
[Zobrazit/Skrýt nabídky vlevo]
[Zobrazit/Skrýt nabídky vpravo]

ansible.zab.cldn.eu

Ansible server

Server pro centralni spravu konfigurace.

IP 10.0.12.30:22
DNS ansible.zab.cldn.eu
root 1:5tzk+Zyf3ujjmcXk6cnZx6s=


Prihlaseni jen pomoci SSH klice pres uzivatele uvt.

Nastaveni, konfigurace a syntaxe je dobre zdokumentovano:

http://docs.ansible.com/ansible/

Definice spravovanych serveru:
/etc/ansible/hosts
Adresar se zdrojovymi soubory pro spravovane servery:
/etc/ansible/src/${servername}
Definice souboru ve formatu YAML pro ansible playbook:
/etc/ansible/yml/${servername}.yml


Priklad pridani serveru s centralni spravou konfigurace amavisu:

Na vzdaleny server pokud jiz neni pridame do /root/.ssh/authorized_keys verejnou cast SSH klice:

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA17RFF7h00TaVHmnDqR5HtD6HI04oRUB0Qxl5vOdx3xik5a75C7Lvk05ePurlbxQksHAjnlPBjghhp88uob1FS1SsRXr2YyC05BYh0XfTGSvVqxWSytd/Vr0YDWFf7M6p+9vQE8srTYo0HVoZL3BmQxk9Oe5VmFqwhXjS0JPHNJ1Ur7vINIO/bXtKnOvQW2wfbEH/bpa58l+/VTy4sgaBhUuoPZ3ABK70odQR8THnZHWVhW+5EoB6wKOSTnYnNLOdmso9ezTxa0RqXEprEeKP/E1zWNLoxDRTW7aNt7PQcwH8BsZAMVt4tO88iIloIDuKJciVt7eWqK+JzlHptDvU4Q== root@ansible


Do /etc/ansible/hosts ke pozadovane skupine pridame definici vzdaleneho serveru, priklad:

[antispam]
antispam_template ansible_ssh_host=10.0.11.194 ansible_ssh_port=10004


Overime spojeni, pripadne povolime na firewallu:

# ansible antispam_template -m ping


Do adresare se zdrojovymi soubory ulozime aktualni konfiguraci amavisu ze vzdaleneho serveru:

/etc/ansible/src/antispam_template
/etc/ansible/src/antispam_template/etc
/etc/ansible/src/antispam_template/etc/amavisd
/etc/ansible/src/antispam_template/etc/amavisd/ldap.conf
/etc/ansible/src/antispam_template/etc/amavisd/amavisd.conf.tmpl
/etc/ansible/src/antispam_template/etc/amavisd/custom_policy.conf
/etc/ansible/src/antispam_template/etc/amavisd/amavisd.conf.orig
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-virus-recipient.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-problem-feedback.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-spam-sender.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-release-quarantine.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-virus-sender.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-spam-admin.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/charset
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-virus-admin.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-dsn.txt
/etc/ansible/src/antispam_template/etc/amavisd/cs_CZ/template-auto-response.txt
/etc/ansible/src/antispam_template/etc/amavisd/lists
/etc/ansible/src/antispam_template/etc/amavisd/lists/black.lst
/etc/ansible/src/antispam_template/etc/amavisd/lists/white.lst
/etc/ansible/src/antispam_template/etc/amavisd/lists/local-domains.lst
/etc/ansible/src/antispam_template/etc/amavisd/amavisd.conf
/etc/ansible/src/antispam_template/etc/amavisd/banned.conf


nebo pouzijem modul fetch, pouze pro soubory:

# ansible antispam_template -m fetch -a 'src=/etc/amavisd/amavisd.conf dest=/etc/ansible/src'


Pripravime YAML soubor pro ansible-playbook:

# cat /etc/ansible/yml/antispam_template.yml 
---
- hosts: antispam_template
  tasks:
    - name: synchronize amavisd configuration
      synchronize:
        src=/etc/ansible/src/antispam_template/etc/amavisd
        dest=/etc
        delete=yes
        recursive=yes
    - name: reload amavisd
      service: name=amavisd state=reloaded


Provedem nahrazeni konfigurace:

# ansible-playbook /etc/ansible/yml/antispam_template.yml




Created by maty. Last Modification: Středa 11 of duben, 2018 10:35:29 CEST by dfabian.