Wednesday 27 April 2022

Install Ansible on Ubuntu 22.04 and Configure in the user/current Directory

sudo apt install -f

sudo apt install software-properties-common

sudo apt-add-repository ppa:ansible/ansible

sudo apt update

sudo apt install ansible

ansible --version

ansible [core 2.12.4]

  config file = /etc/ansible/ansible.cfg

Configure ansible in the current directory /home/ansible

cat ansible.cfg


inventory - /home/ansible/inventory

cat inventory


ansible --version

ansible [core 2.12.4]

  config file = /home/ansible/ansible.cfg

hostname -i

sudo hostnamectl set-hostname controller

exec bash


sudo echo " controller" | sudo tee -a /etc/hosts controller

cat /etc/hosts

ansible all --list

  hosts (1):


#run "sudo apt install" if  Failed sudo: a password is required

#hosts: localhost, in playbook 

ansible-playbook install.yml

No comments:

Post a Comment