GNU/Linux >> Linux Esercitazione >  >> Ubuntu

Come installare Ansible su Ubuntu Server 21.04

Cos'è Ansible?

Abile è uno strumento open source di fornitura di software, gestione della configurazione e distribuzione di applicazioni che abilita l'infrastruttura come codice. Funziona su molti sistemi simili a Unix e può configurare sia sistemi simili a Unix che Microsoft Windows. Include il proprio linguaggio dichiarativo per descrivere la configurazione del sistema. Ansible è stato scritto da Michael DeHaan e acquisito da Red Hat nel 2015. Ansible è senza agenti e si connette temporaneamente in remoto tramite SSH o Windows Remote Management (consentendo l'esecuzione remota di PowerShell) per svolgere le sue attività.

In altre parole puoi eseguire un comando su più server e guadagnare tempo.

Come installare Ansible nel server Ubuntu?

# Update server
sudo apt-get update
sudo apt-get upgrade -y

# Install dependences
sudo apt-get install python -y

# Install repository
sudo apt-add-repository ppa:ansible/ansible

# Install ansible
sudo apt install ansible 
Code language: Bash (bash)

Come aggiungere host ad ansbile?

sudo nano /etc/ansible/hosts
/etc/ansible/hosts

[servers]
server1 ansible_host=10.20.0.2
server2 ansible_host=10.20.0.3
server3 ansible_host=10.20.0.4

[all:vars]
ansible_python_interpreter=/usr/bin/python3
Code language: JavaScript (javascript)

Come controllare i server aggiunti?

sudo ansible-inventory --list -y
Code language: PHP (php)
output

all:
  children:
    servers:
      hosts:
        server1:
          ansible_host: 10.20.0.2
          ansible_python_interpreter: /usr/bin/python3
        server2:
          ansible_host: 10.20.0.3
          ansible_python_interpreter: /usr/bin/python3
        server3:
          ansible_host: 10.20.0.4
          ansible_python_interpreter: /usr/bin/python3
    ungrouped: {}
Code language: JavaScript (javascript)

Come testare la connessione ai server Ansible?

sudo ansible all -m ping -u root
output

server1 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
server2 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
server3 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
Code language: JavaScript (javascript)

Come eseguire un comando su tutti i server?

sudo ansible all -a "df -h" -u root
Code language: JavaScript (javascript)

Conclusione

in conclusione possiamo dire che ansible è un meraviglioso software per la gestione di più server Linux in tutto il mondo, estremamente facile e accessibile da lavorare

Video tutorial su come installare

Ci auguriamo che questo articolo ti sia piaciuto. In tal caso, valuta questa pagina con le stelle qui sotto e iscriviti al nostro canale YouTube.


Ubuntu
  1. Come installare Nginx Web Server su Ubuntu 18.04

  2. Come installare RabbitMQ Server su Ubuntu 18.04 e 16.04 LTS

  3. Come installare Gitlab Server su Ubuntu 18.04 e 16.04 LTS

  4. Come installare MsSQL Server 2019 su Ubuntu 20.04

  5. Come installare il server Xrdp su Ubuntu 20.04 LTS

Come installare Webmin su Ubuntu 18.04 e Ubuntu 16.04 Server

Come installare CouchPotato su Ubuntu Server/Desktop

Come installare il server FTP su Ubuntu 20.04 LTS

Come installare Ansible Server su Ubuntu 18.04

Come installare il server Minecraft su Ubuntu 20.04

Come installare Jellyfin Media Server su Ubuntu 20.04