DevOps Classroom notes 05/Nov/2024

Ansible

inventories in ansible

  • Ansible inventory is collection of nodes and is of two types
    • static inventory: we specify ip’s or names
    • dynamic inventory: we execute the script to get ips or names dynamically
  • Static inventory can be specified in two formats Refer Here
    • ini
    • yaml
  • ini format
  • yaml format

Ansible facts

  • Ansible collects the information about the node by executing a module setup Refer Here
  • setup module Refer Here

Ansible conditionals

Ansible adhoc commands

ansible -i hosts -m "<module-name>" -a "<argumets/parameters>" all
  • Lets install unzip
ansible.builts.file:
  path: /tmp/1.txt
  state: touch
  • Adhoc command
ansible -i hosts -m "file" -a "path=/tmp/1.txt state=touch"

Activity 2: Work with different distributions

  • Install apache server on redhat and ubuntu
  • manual steps for ubuntu
sudo apt update
sudo apt install apache2 -y

  • manual steps for redhat
sudo dnf install httpd -y
sudo systemctl enable httpd
sudo systemctl start httpd
  • To install apache on both redhat and ubuntu
  • Note:
    • on redhat ssh conf /etc/ssh/sshd_config.d/50-cloud-init.conf
    • service name on redhat sshd
  • Refer Here for the changes done.
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%