trying using ec2 module from python but inventory is missing

hi,
I tried to find similar problem on this forum or through google but I was redirected to ansible cmd.

I am writing python tool that can modify ec2 resources. I started with sec groups. here is sample code I try to execute

`
properties = {}
runner = ansible.Runner(
module_name=“ec2_group”,
complex_args={

    "rules": properties["rules"],
    "rules_egress": properties["rules_egress"],
    "vpc_id": properties["vpcId"],
    "name": properties["name"],
    "description": properties["descr"]

},
forks=10,
inventory=Inventory(“local_action”)
)

return runner.run()
`

off course it fails with ansible.errors.AnsibleError: Unable to find an inventory file, specify one with -i which would probably make sense when run directly using ansible cli, but I have no idea how I should code it from python.
the documentation or examples are non-existence or it is very hard to find them

here is a role part from my yaml file

`

I am really frustrated :slight_smile:
running playbook from terminal would be something like

ansible-playbook -i stage defienition.yml --private-key=~/.ssh/key.pem

where stage is a directory containing hosts file containing

`
[local]
127.0.0.1

`

I keep trying change my previous code

OOOk I figure it out,