DevOps Classroomnotes 14/Jun/2023

Ansible Dynamic inventory

  • Ansible supports dynamic inventory.
  • Dynamic inventory can be acheived by
    • plugins
    • scripts
  • Refer Here for official docs
  • Dynamic inventory in script form can be written in any language of your choice. The condition is this file has to be executable.
  • Ansible dynamic inventory should return data in the below format
{
  "_meta": {
      "hostvars": {
          "instance-01": {
              "aws_ami_launch_index_ec2": 0,
              "aws_architecture_ec2": "x86_64",
              "ebs_optimized": false,
              "ec2_tag_Environment": "dev",
              "ec2_tag_Name": "instance-01",
              "ec2_tag_Tag1": "Test1",
              "ec2_tag_Tag2": "Test2",
              "ena_support": true,
              "enclave_options": {
                  "enabled": false
              }
          },
          "instance-02": {
            "ebs_optimized": false,
            "ec2_tag_Environment": "dev",
            "ec2_tag_Name": "instance-02",
            "ec2_tag_Tag1": "Test3",
            "ec2_tag_Tag2": "Test4",
            "ena_support": true,
            "enclave_options": {
                "enabled": false
            }
          }
      }
  },
  "all": {
        "children": [
            "aws_ec2",
            "ungrouped"
        ]
    },
    "aws_ec2": {
        "hosts": [
            "instance-01",
            "instance-02"
        ]
    }
}

Ansible in CI/CD Pipelines

  • Two ways of using ansible in CI/CD
    • Directly from CI/CD
      Preview
    • From Infra Provisioning
      Preview

Ansible Vault

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Wordpress Development Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube