LINUXCAMP_TG Telegram 355
Что такое Ansible - и как обновить пакеты сразу на 10 серверах

Ansible - это инструмент для автоматизации. Он позволяет управлять сотнями серверов как одним: обновлять, настраивать, перезапускать сервисы - всё с помощью простого playbook (набор команд в YAML-файле).

Для начала нужно скачать Ansible:


sudo apt install ansible -y


Вот минимальный пример update.yml:


- name: Обновление пакетов
hosts: all
become: yes # получаем root-доступ
tasks:
- name: apt update && upgrade
apt:
update_cache: yes
upgrade: dist


Как это работает:

hosts: all - применяем ко всем серверам из инвентаря
become: yes - выполняем от имени root
apt: - встроенный модуль Ansible для Debian/Ubuntu

Запуск:


ansible-playbook -i inventory update.yml


Для подробностей можно добавить -v или -vvv:


ansible-playbook update.yml -vvv


А если хочешь сначала посмотреть, что бы изменилось, но не выполнять, используй режим dry run:


ansible-playbook update.yml --check


LinuxCamp | #utils
👍2713🔥6



tgoop.com/linuxcamp_tg/355
Create:
Last Update:

Что такое Ansible - и как обновить пакеты сразу на 10 серверах

Ansible - это инструмент для автоматизации. Он позволяет управлять сотнями серверов как одним: обновлять, настраивать, перезапускать сервисы - всё с помощью простого playbook (набор команд в YAML-файле).

Для начала нужно скачать Ansible:


sudo apt install ansible -y


Вот минимальный пример update.yml:


- name: Обновление пакетов
hosts: all
become: yes # получаем root-доступ
tasks:
- name: apt update && upgrade
apt:
update_cache: yes
upgrade: dist


Как это работает:

hosts: all - применяем ко всем серверам из инвентаря
become: yes - выполняем от имени root
apt: - встроенный модуль Ansible для Debian/Ubuntu

Запуск:


ansible-playbook -i inventory update.yml


Для подробностей можно добавить -v или -vvv:


ansible-playbook update.yml -vvv


А если хочешь сначала посмотреть, что бы изменилось, но не выполнять, используй режим dry run:


ansible-playbook update.yml --check


LinuxCamp | #utils

BY LinuxCamp | DevOps


Share with your friend now:
tgoop.com/linuxcamp_tg/355

View MORE
Open in Telegram


Telegram News

Date: |

Ng Man-ho, a 27-year-old computer technician, was convicted last month of seven counts of incitement charges after he made use of the 100,000-member Chinese-language channel that he runs and manages to post "seditious messages," which had been shut down since August 2020. The imprisonment came as Telegram said it was "surprised" by claims that privacy commissioner Ada Chung Lai-ling is seeking to block the messaging app due to doxxing content targeting police and politicians. Judge Hui described Ng as inciting others to “commit a massacre” with three posts teaching people to make “toxic chlorine gas bombs,” target police stations, police quarters and the city’s metro stations. This offence was “rather serious,” the court said. The group also hosted discussions on committing arson, Judge Hui said, including setting roadblocks on fire, hurling petrol bombs at police stations and teaching people to make such weapons. The conversation linked to arson went on for two to three months, Hui said. A few years ago, you had to use a special bot to run a poll on Telegram. Now you can easily do that yourself in two clicks. Hit the Menu icon and select “Create Poll.” Write your question and add up to 10 options. Running polls is a powerful strategy for getting feedback from your audience. If you’re considering the possibility of modifying your channel in any way, be sure to ask your subscribers’ opinions first.
from us


Telegram LinuxCamp | DevOps
FROM American