Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDS cluster dynamic inventory support #16606

Merged
merged 5 commits into from
Aug 15, 2016

Commits on Jul 6, 2016

  1. Make it possible to use boto3_conn outside modules

    The `boto3_conn` function requires a module argument, and calls
    `module.fail_json` if the connection doesn't receive enough arguments.
    In non-module settings like inventory scripts, there is no module to be
    passed.
    
    The `boto3_inventory_conn` function takes the same arguments except for
    `module`, and both call _boto3_conn which doesn't require a module be
    passed.
    ryansb committed Jul 6, 2016
    Configuration menu
    Copy the full SHA
    ddf2a73 View commit details
    Browse the repository at this point in the history
  2. Add RDS cluster info to EC2 dynamic inventory

    Add db_clusters to the ec2 inventory. Show tags. Only show clusters
    matching tags in the `.ini`. Set `include_rds_clusters = True` option to
    enable RDS cluster inventory collection.
    
    Example inventory output:
    
    ```
    {
      "db_clusters": {
        "ryansb-cluster-test": {
          "AllocatedStorage": 1,
          "AvailabilityZones": [
            "us-west-2a",
            "us-west-2b",
            "us-west-2c"
          ],
          "BackupRetentionPeriod": 1,
          "DBClusterIdentifier": "ryansb-cluster-test",
          "DBClusterMembers": [
            {
              "DBClusterParameterGroupStatus": "in-sync",
              "DBInstanceIdentifier": "ryansb-test",
              "IsClusterWriter": true,
              "PromotionTier": 1
            },
            {
              "DBClusterParameterGroupStatus": "in-sync",
              "DBInstanceIdentifier": "ryansb-test-us-west-2b",
              "IsClusterWriter": false,
              "PromotionTier": 1
            }
          ],
          "DBClusterParameterGroup": "default.aurora5.6",
          "DBSubnetGroup": "default",
          "DatabaseName": "mydb",
          "DbClusterResourceId": "cluster-OB6H7JQURFKFD4BYNHG5HSRLBA",
          "Endpoint": "ryansb-cluster-test.cluster-c9ntgaejgqln.us-west-2.rds.amazonaws.com",
          "Engine": "aurora",
          "EngineVersion": "5.6.10a",
          "MasterUsername": "admin",
          "Port": 3306,
          "PreferredBackupWindow": "06:09-06:39",
          "PreferredMaintenanceWindow": "mon:11:22-mon:11:52",
          "ReadReplicaIdentifiers": [],
          "Status": "available",
          "StorageEncrypted": false,
          "VpcSecurityGroups": [
            {
              "Status": "active",
              "VpcSecurityGroupId": "sg-47eaea20"
            }
          ]
        }
      },
      "rds": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "rds_aurora": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "rds_parameter_group_default_aurora5_6": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "ryansb-test": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "ryansb-test-us-west-2b": [
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "type_db_r3_large": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "us-west-2": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "us-west-2a": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "us-west-2b": [
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ],
      "vpc_id_vpc_3ca34459": [
        "ryansb_test_c9ntgaejgqln_us_west_2_rds_amazonaws_com",
        "ryansb_test_us_west_2b_c9ntgaejgqln_us_west_2_rds_amazonaws_com"
      ]
    }
    ```
    Tom Paine authored and ryansb committed Jul 6, 2016
    Configuration menu
    Copy the full SHA
    bb5a1f7 View commit details
    Browse the repository at this point in the history
  3. Fail softly when boto3 is not installed

    Updated as per @ryansb comments. The EC2 inventory script will now fail
    with a useful message when boto3 is not installed and the user is trying
    to read RDS cluster information.
    aioue authored and ryansb committed Jul 6, 2016
    Configuration menu
    Copy the full SHA
    418f91d View commit details
    Browse the repository at this point in the history
  4. Respect profiles & credentials for boto3 inventory

    Using boto3 directly wasn't properly using profiles set in the `ec2.ini`
    file, this change uses the `module_utils` boto3_conn instead.
    ryansb committed Jul 6, 2016
    Configuration menu
    Copy the full SHA
    59e499f View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2016

  1. Configuration menu
    Copy the full SHA
    0783c17 View commit details
    Browse the repository at this point in the history