Ansible

Ansible installation in amazon linux2 machine:

  • sudo amazon-linux-extras install ansible2
    • ansible --version    (ansible 2.9.23)
      • config file = /etc/ansible/ansible.cfg
    •  ansible.cfg -----------------------Default configuration related file.
    •  hosts ------------------------------Host inventory file   
    • roles 
  • python --version   (python 2.7.18)











Create ansible master-node:

  • install ansible
  • Create a user ------------------------(ansibleuser)
  • Allocate password to him
  • Visudo
    • Ansible-user           ALL=(ALL)       NOPASSWD: ALL
  • /etc/sshd/sshd_config
    • Change Password_Authentication
  • service sshd restart
  • Login an a ansible user ------------- (ansibleuser)
  • ssj-keygen
    • id_rsa
    • id_rsa.pub

Create a ansible worker-node:

  • Create a user ------------------------(ansibleuser)
  • Allocate password to him
  • Visudo
    • ansible-user           ALL=(ALL)       NOPASSWD: ALL
  • /etc/sshd/sshd_config
    • Change Password_Authentication
  • service sshd restart
  • Login an a ansible user ------------- (ansibleuser)

Create a User:

  • useradd ansible-user
  • passwd ansible-user
  • visudo
    • #allow root to run any commands anywhere
    • Ansible-user            ALL=(ALL)  NOPASSWD: ALL
  • :wq!  (write + quit + exit)

Password_Authentication:

  • /etc/ssh
  • vi sshd_config
    • password Authentication Yes --------------------(by default is will be “NO”)
  • service sshd restart

Generate ssh Keypair:

  • The keypair is a combination of private key & private key.
  • Private Key + public Key.
    • ssh-keygen-------------------------Pvt (List) + pub (Card)
  • goto
    • /home/ansible-user/.sshd
      • id_rsa
      • id_rsa.pub
  • .
  • ssh-copy-id-------------------------Share public key
  • ssh ‘ansibleuser@172.31.38.25
  • exit
Ansible commands:

  • ansible -m ping all








Comments

Popular posts from this blog

AWS

Linux

kubernetes