Skip to content

Allow volumes in platforms to be list of dict #167

Open
@isuftin

Description

Issue Type

  • Bug report

Molecule and Ansible details

ansible --version && molecule --version
ansible [core 2.12.10]
  config file = /Users/isuftin/.ansible.cfg
  configured module search path = ['/Users/isuftin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/isuftin/.pyenv/versions/3.9.10/envs/development/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/isuftin/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/isuftin/.pyenv/versions/development/bin/ansible
  python version = 3.9.10 (main, Jan 31 2022, 16:09:50) [Clang 12.0.0 (clang-1200.0.32.29)]
  jinja version = 3.1.2
  libyaml = True

molecule 4.0.3 using python 3.9 
    ansible:2.12.10
    delegated:4.0.3 from molecule
    docker:2.1.0 from molecule_docker requiring collections: community.docker>=3.0.2 ansible.posix>=1.4.0
    ec2:0.4 from molecule_ec2
    vagrant:1.0.0 from molecule_vagrant

Molecule installation method (one of):

  • pip

Ansible installation method (one of):

  • pip

Detail any linters or test runners used:

Desired Behavior

The Molecule EC2 driver uses the amazon.aws.ec2_instance module to drive machine creation. This means that if we specify volumes in a platform, it should be a list of dict, not a list of string. The latest release of Molecule mandates that volumes be a list of strings as per https://raw.githubusercontent.com/ansible-community/molecule/main/src/molecule/data/molecule.json

This breaks us being able to use the Molecule EC2 driver.

The desired behavior is to not break on the unexpected volumes param type

Actual Behaviour

Example platform:

platforms:
  - name: my-platform
    region: us-west-2
    vpc_id: vpc-xxxxxx
    vpc_subnet_id: subnet-xxxxxx
    instance_type: t3a.medim
    security_groups:
      - sg-xxxxxxxx
    aws_iam_role: xxxxxxxxx
    volumes:
      - device_name: /dev/sda1
        ebs:
          volume_size: 250
          delete_on_termination: 'true'
      - device_name: /dev/sdb
        ebs:
          volume_size: 30
          delete_on_termination: 'true'
    image: ami-xxxxxxx
    key_inject_method: ec2
molecule list

molecule lint -s CRITICAL Failed to validate /path/to/my/role/molecule/aws-marketplace-centos7-ec2/molecule.yml

["{'device_name': '/dev/sda1', 'ebs': {'volume_size': 250, 'delete_on_termination': 'true'}} is not of type 'string'"]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions