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
    • From Infra Provisioning

Ansible Vault

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
Customized Social Media Icons from Acurax Digital Marketing Agency
Exit mobile version
%%footer%%