Ansible: различия между версиями

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


=== Пример вывода ===
=== Пример вывода ===
Вывод "цветастый": зеленый в случае успеха (exit 0), красный - в других случаях.


<pre>
<pre>
Строка 88: Строка 90:
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
</pre>
</pre>


== Ссылки ==
== Ссылки ==
* [http://bugs.etersoft.ru/show_bug.cgi?id=10697]
* [http://bugs.etersoft.ru/show_bug.cgi?id=10697]

Версия 17:10, 19 мая 2016

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'

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

Вывод "цветастый": зеленый в случае успеха (exit 0), красный - в других случаях.

 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.

Ссылки