Ansible

Материал из Etersoft wiki
Перейти к навигацииПерейти к поиску

Ansible — yet another система управления конфигурациями.

Установка

epmi ansible ansible-shell

Настройка

Включить копирование файлов

Без этой опции возникали ошибки при копировании файлов. Указанная настройка полезна в целях совместимости с различными системами.

cd /etc/ansible

diff ansible.cfg ansible.cfg.rpmnew 
209c209
< scp_if_ssh = True
---
> #scp_if_ssh = True

Указать список машин

[gluster]
server
snail
cellar
asu
multi
vbox
lav
lin-test
euclid
nun
windsor
space1

[clients]
ant
grape

[test]
ant

[pc]
asu
atlant
buh
cellar
euclid
grape
lav
lin-test
multi
nun
server
snail
testing
virtualbox
windsor
azbykar
devel
host03
priv
router
space1
space2

Запуск

  • Посмотреть доступную память
ansible pc -m shell -a 'sudo dmidecode --type memory | egrep "(Size:*|Type: DDR*)" | egrep -v "(Installed S |Enabled|Not I)" | sort | uniq -c'
  • Установить nano
ansible test -m shell -a 'sudo epmu; sudo epmi nano'

Пример вывода

 ansible pc -m shell -a 'sudo dmidecode --type memory | egrep "(Size:*|Type: DDR*)" | egrep -v "(Installed S |Enabled|Not I)" | sort | 

atlant | success | rc=0 >>
      2 	Installed Size: 512 MB (Double-bank Connection)
      1 	Maximum Memory Module Size: 1024 MB
      1 	Maximum Total Memory Size: 2048 MB
      2 	Size: 512 MB

buh | FAILED => SSH Error: ssh: connect to host buh port 22: No route to host
    while connecting to 192.168.0.49:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.


Ссылки