Wednesday, February 28, 2018

how to install ansible centos7

Ansible on centos7

Step 1 — Installing Ansible
sudo yum install epel-release
sudo yum install ansible

Step 2 — Configuring Ansible Hosts
sudo vi /etc/ansible/hosts

by default, try to connect to remote hosts using current username.
If that user doesn't exist on the remote system

connect to servers in the "servers" group with the sammy user
sudo mkdir /etc/ansible/group_vars

create YAML-formatted files for each group
sudo nano /etc/ansible/group_vars/servers

specify configuration details for every server
/etc/ansible/group_vars/all.
Individual hosts
/etc/ansible/host_vars.



Ping all of the servers
ansible -m ping all

ansible -m ping host1
ansible -m ping host1:host2

 memory usage on our host1 machine
ansible -m shell -a 'free -m' host1

Usage: ansible <host-pattern> [options]
-m MODULE_NAME, --module-name=MODULE_NAME

No comments:

Post a Comment