Инструменты пользователя

Инструменты сайта


it:ansible

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слеваПредыдущая версия
Следующая версия
Предыдущая версия
it:ansible [2022/04/11 11:36] ura2404it:ansible [2025/03/06 08:00] (текущий) ura2404
Строка 2: Строка 2:
 [[https://www.ansible.com/]] [[https://www.ansible.com/]]
  
-[[it:ansible:setup|Установка]]\\+[[it:ansible:setup|Установка в виртуальное окружение]]\\
 [[it:ansible:options|Параметры команды ansible]]\\ [[it:ansible:options|Параметры команды ansible]]\\
  
 [[it:ansible:module|Модули]]\\ [[it:ansible:module|Модули]]\\
 +[[it:ansible:role|Роли]]\\
 +
 +[[it:ansible:ansible_os_family|ansible_os_family]]\\
  
 ---- ----
  
-__**RomNero**__\\ +https://docs.ansible.com/ansible/latest/collections/ansible/builtin/add_host_module.html Add a host (and alternatively a group) to the ansible-playbook in-memory inventory\\
-[[https://youtu.be/YYjCwLs-1hA]] - Всё что нужно знать по AnsibleОсновы и не только.\\ +
-[[https://youtu.be/Uk1gGzdW00o]] 13 Ansible: Roles. Создание ролей.\\+
  
  
 [[https://youtu.be/2p8y9wdsvVE]] - Ansible: быстрый старт Бесплатный урок OTUS\\ [[https://youtu.be/2p8y9wdsvVE]] - Ansible: быстрый старт Бесплатный урок OTUS\\
  
-[[https://www.8host.com/blog/kak-rabotat-s-ansible-prostaya-i-udobnaya-shpargalka/]] {{it:ansible:kak_rabotat_s_ansible-_prostaja_i_udobnaja_shpargalka.mht|mht}} - КАК РАБОТАТЬ С ANSIBLE: ПРОСТАЯ И УДОБНАЯ ШПАРГАЛКА\\ +[[https://www.8host.com/blog/kak-rabotat-s-ansible-prostaya-i-udobnaya-shpargalka/|КАК РАБОТАТЬ С ANSIBLE: ПРОСТАЯ И УДОБНАЯ ШПАРГАЛКА]] {{it:ansible:kak_rabotat_s_ansible-_prostaja_i_udobnaja_shpargalka.mht|mht}}\\ 
-[[https://stackoverflow.com/questions/25326386/ansible-define-inventory-at-run-time]] {{it:ansible:define_inventory_at_run_time.mht|mht}}- динамическое формирование списка хостов\\ +[[https://stackoverflow.com/questions/25326386/ansible-define-inventory-at-run-time|динамическое формирование списка хостов]] {{it:ansible:define_inventory_at_run_time.mht|mht}}\\ 
-[[https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-lamp-on-ubuntu-18-04-ru]] {{it:ansible:ispolzovanie_ansible_dlja_ustanovki_i_nastrojki_lamp.mht|mht}} - Использование Ansible для установки и настройки LAMP в Ubuntu 18.04\\+[[https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-lamp-on-ubuntu-18-04-ru|Использование Ansible для установки и настройки LAMP в Ubuntu 18.04]] {{it:ansible:ispolzovanie_ansible_dlja_ustanovki_i_nastrojki_lamp.mht|mht}}\\ 
 +[[https://youtu.be/20g9BNilDvg|20-Ansible - Хранение Секретов - ansible-vault]]\\ 
 +[[http://linuxsql.ru/content/ansible-izuchaem-i-sozdaem-roli-roles-lesson-8|Ansible: изучаем и создаем Роли (Roles). Lesson 8]] {{it:ansible:ansible-_izuchaem_i_sozdaem_roli_roles_.mht|mht}} 
 + 
 +__**RomNero**__\\ 
 +[[https://youtu.be/YYjCwLs-1hA|Всё что нужно знать по Ansible. Основы и не только]]\\ 
 +[[https://youtu.be/WvvEWvemT_M|12 Ansible: Template. Шаблоны]]\\ 
 +[[https://youtu.be/Uk1gGzdW00o|13 Ansible: Roles. Создание ролей]]\\
  
  
 **Unix way**\\ **Unix way**\\
-[[https://youtu.be/n27bpkAtyf4|Ansible. Часть 1. Основы]] +[[https://youtu.be/n27bpkAtyf4|Ansible. Часть 1. Основы]]\\ 
-[[https://youtu.be/5JcL3c6rPE8|Ansible. Часть 2. Playbook]]+[[https://youtu.be/5JcL3c6rPE8|Ansible. Часть 2. Playbook]]\\ 
 + 
 +---- 
 + 
 +Пакеты: 
 +>sshpass
  
 ---- ----
Строка 55: Строка 68:
 ansible -i inventory/hosts.yaml -m debug -a "var=hostvars[inventory_hostname].ansible_host" all ansible -i inventory/hosts.yaml -m debug -a "var=hostvars[inventory_hostname].ansible_host" all
 </code> </code>
 +
 ---- ----
 +
 +__**Проверить статус сервиса**__
 +<code bash>
 +ansible hard -i inv/hosts.yml -b -m shell -a "service cron status | grep 'Active'"
 +</code>
 +
 +----
 +
 +__**Посмотреть всё интерфейсы**__
 +<code>
 +- name: Display all interfaces
 +  debug:
 +    msg: "{{ msg.split('\n') }}"
 +  vars:
 +    msg: |
 +        {% for iface in ansible_interfaces|sort %}
 +            System interface {{ iface }}
 +            {{ vars.ansible_facts[iface] | to_nice_json }}
 +        {% endfor %}
 +</code>
 +
 +__**homedir пользователя**__
 +<code>
 +- name: Get user homedir
 +  shell: eval echo "~"
 +  register: homedir
 +  become: true
 +  become_user: "{{ environment_user }}"
 +  no_log: yes
 +  tags: [os]
 +
 +</code>
it/ansible.1649676964.txt.gz · Последнее изменение: 2022/04/11 11:36 — ura2404