Быстрая установка — различия между версиями
Root (обсуждение | вклад) |
Root (обсуждение | вклад) |
||
Строка 12: | Строка 12: | ||
roles_path = /etc/ansible/roles | roles_path = /etc/ansible/roles | ||
callback_plugins = /usr/share/ansible/plugins/callback | callback_plugins = /usr/share/ansible/plugins/callback | ||
+ | |||
+ | Создаём inventory - hosts | ||
+ | [hosts:vars] | ||
+ | ansible_python_interpreter=/usr/bin/python3 | ||
+ | ansible_user=ansible | ||
+ | ansible_become=true | ||
+ | ansible_ssh_private_key_file=/home/ansible/.ssh/id_rsa | ||
+ | [hosts] | ||
+ | app01.iwad.ru | ||
+ | app02.iwad.ru | ||
+ | db01.iwad.ru | ||
+ | db02.iwad.ru | ||
+ | |||
+ | [APP] | ||
+ | app01.iwad.ru | ||
+ | app01.iwad.ru | ||
+ | |||
+ | [DB] | ||
+ | db01.iwad.ru | ||
+ | db02.iwad.ru | ||
+ | |||
Заводим пользователя на клиентах | Заводим пользователя на клиентах |
Версия 11:17, 24 февраля 2023
Устанавливаем на хосте управления
apt install software-properties-common apt-add-repository --yes --update ppa:ansible/ansible apt install ansible
Конфиг ansible.cfg
[defaults] inventory = /etc/ansible/hosts host_key_checking = False remote_tmp = ~/.ansible/tmp roles_path = /etc/ansible/roles callback_plugins = /usr/share/ansible/plugins/callback
Создаём inventory - hosts
[hosts:vars] ansible_python_interpreter=/usr/bin/python3 ansible_user=ansible ansible_become=true ansible_ssh_private_key_file=/home/ansible/.ssh/id_rsa [hosts] app01.iwad.ru app02.iwad.ru db01.iwad.ru db02.iwad.ru [APP] app01.iwad.ru app01.iwad.ru [DB] db01.iwad.ru db02.iwad.ru
Заводим пользователя на клиентах
useradd -u 20000 -s /bin/bash -m -d /home/ansible ansible mkdir /home/ansible/.ssh touch /home/ansible/.ssh/authorized_keys chown -R ansible:ansible /home/ansible echo "SSH PUBLIC KEY" > /home/ansible/.ssh/authorized_keys touch /etc/sudoers.d/ansible echo "ansible ALL=(root) NOPASSWD: ALL" > /etc/sudoers.d/ansible