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

destroy fails if create was not invoked first #150

Open
ghost opened this issue May 6, 2023 · 1 comment
Open

destroy fails if create was not invoked first #150

ghost opened this issue May 6, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented May 6, 2023

Action: Invoke "molecule destroy" for the first time

Expected behavior: "molecule destroy" finds no EC2 instance to destroy, and returns success

Observed behavor: "molecule destroy" fails in ec2_instance.py, in get_default_subnet, with a "TypeError: 'NoneType' object is not subscriptable" error

NOTE: If "molecule create" is called first, followed by "molecule destroy", "molecule destroy" functions as expected. This problem also prevents "molecule check" from working properly.

Example output:

$ python -m venv .venv

$ source .venv/bin/activate

(.venv) $ python -VV
Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]

(.venv) $ python -m site
sys.path = [
    '/home/myuser/projects/ansible/ansible-role-molecule_ec2_template',
    '/usr/lib/python310.zip',
    '/usr/lib/python3.10',
    '/usr/lib/python3.10/lib-dynload',
    '/home/myuser/projects/ansible/ansible-role-molecule_ec2_template/.venv/lib/python3.10/site-packages',
]
USER_BASE: '/home/myuser/.local' (exists)
USER_SITE: '/home/myuser/.local/lib/python3.10/site-packages' (exists)
ENABLE_USER_SITE: False

(.venv) $ python -m pip install --upgrade pip setuptools wheel
Requirement already satisfied: pip in ./.venv/lib/python3.10/site-packages (22.0.2)
Collecting pip
  Using cached pip-23.1.2-py3-none-any.whl (2.1 MB)
Requirement already satisfied: setuptools in ./.venv/lib/python3.10/site-packages (59.6.0)
Collecting setuptools
  Using cached setuptools-67.7.2-py3-none-any.whl (1.1 MB)
Collecting wheel
  Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
Installing collected packages: wheel, setuptools, pip
  Attempting uninstall: setuptools
    Found existing installation: setuptools 59.6.0
    Uninstalling setuptools-59.6.0:
      Successfully uninstalled setuptools-59.6.0
  Attempting uninstall: pip
    Found existing installation: pip 22.0.2
    Uninstalling pip-22.0.2:
      Successfully uninstalled pip-22.0.2
Successfully installed pip-23.1.2 setuptools-67.7.2 wheel-0.40.0

(.venv) $ python -m pip install -r requirements.txt
Collecting ansible==7.5.0 (from -r requirements.txt (line 1))
  Using cached ansible-7.5.0-py3-none-any.whl (43.6 MB)
Collecting ansible-compat==3.0.2 (from -r requirements.txt (line 2))
  Using cached ansible_compat-3.0.2-py3-none-any.whl (19 kB)
Collecting ansible-core==2.14.5 (from -r requirements.txt (line 3))
  Using cached ansible_core-2.14.5-py3-none-any.whl (2.2 MB)
Collecting ansible-lint==6.15.0 (from -r requirements.txt (line 4))
  Using cached ansible_lint-6.15.0-py3-none-any.whl (289 kB)
Collecting arrow==1.2.3 (from -r requirements.txt (line 5))
  Using cached arrow-1.2.3-py3-none-any.whl (66 kB)
Collecting attrs==23.1.0 (from -r requirements.txt (line 6))
  Using cached attrs-23.1.0-py3-none-any.whl (61 kB)
Collecting awscli==1.27.127 (from -r requirements.txt (line 7))
  Using cached awscli-1.27.127-py3-none-any.whl (4.1 MB)
Collecting binaryornot==0.4.4 (from -r requirements.txt (line 8))
  Using cached binaryornot-0.4.4-py2.py3-none-any.whl (9.0 kB)
Collecting black==23.3.0 (from -r requirements.txt (line 9))
  Using cached black-23.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB)
Collecting boto==2.49.0 (from -r requirements.txt (line 10))
  Using cached boto-2.49.0-py2.py3-none-any.whl (1.4 MB)
Collecting boto3==1.26.127 (from -r requirements.txt (line 11))
  Using cached boto3-1.26.127-py3-none-any.whl (135 kB)
Collecting botocore==1.29.127 (from -r requirements.txt (line 12))
  Using cached botocore-1.29.127-py3-none-any.whl (10.7 MB)
Collecting bracex==2.3.post1 (from -r requirements.txt (line 13))
  Using cached bracex-2.3.post1-py3-none-any.whl (12 kB)
Collecting certifi==2022.12.7 (from -r requirements.txt (line 14))
  Using cached certifi-2022.12.7-py3-none-any.whl (155 kB)
Collecting cffi==1.15.1 (from -r requirements.txt (line 15))
  Using cached cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (441 kB)
Collecting chardet==5.1.0 (from -r requirements.txt (line 16))
  Using cached chardet-5.1.0-py3-none-any.whl (199 kB)
Collecting charset-normalizer==3.1.0 (from -r requirements.txt (line 17))
  Using cached charset_normalizer-3.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (199 kB)
Collecting click==8.1.3 (from -r requirements.txt (line 18))
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting click-help-colors==0.9.1 (from -r requirements.txt (line 19))
  Using cached click_help_colors-0.9.1-py3-none-any.whl (5.5 kB)
Collecting colorama==0.4.4 (from -r requirements.txt (line 20))
  Using cached colorama-0.4.4-py2.py3-none-any.whl (16 kB)
Collecting cookiecutter==2.1.1 (from -r requirements.txt (line 21))
  Using cached cookiecutter-2.1.1-py2.py3-none-any.whl (36 kB)
Collecting cryptography==40.0.2 (from -r requirements.txt (line 22))
  Using cached cryptography-40.0.2-cp36-abi3-manylinux_2_28_x86_64.whl (3.7 MB)
Collecting docutils==0.16 (from -r requirements.txt (line 23))
  Using cached docutils-0.16-py2.py3-none-any.whl (548 kB)
Collecting enrich==1.2.7 (from -r requirements.txt (line 24))
  Using cached enrich-1.2.7-py3-none-any.whl (8.7 kB)
Collecting filelock==3.12.0 (from -r requirements.txt (line 25))
  Using cached filelock-3.12.0-py3-none-any.whl (10 kB)
Collecting flake8==6.0.0 (from -r requirements.txt (line 26))
  Using cached flake8-6.0.0-py2.py3-none-any.whl (57 kB)
Collecting hvac==1.1.0 (from -r requirements.txt (line 27))
  Using cached hvac-1.1.0-py3-none-any.whl (144 kB)
Collecting idna==3.4 (from -r requirements.txt (line 28))
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting Jinja2==3.1.2 (from -r requirements.txt (line 29))
  Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB)
Collecting jinja2-time==0.2.0 (from -r requirements.txt (line 30))
  Using cached jinja2_time-0.2.0-py2.py3-none-any.whl (6.4 kB)
Collecting jmespath==1.0.1 (from -r requirements.txt (line 31))
  Using cached jmespath-1.0.1-py3-none-any.whl (20 kB)
Collecting jsonschema==4.17.3 (from -r requirements.txt (line 32))
  Using cached jsonschema-4.17.3-py3-none-any.whl (90 kB)
Collecting markdown-it-py==2.2.0 (from -r requirements.txt (line 33))
  Using cached markdown_it_py-2.2.0-py3-none-any.whl (84 kB)
Collecting MarkupSafe==2.1.2 (from -r requirements.txt (line 34))
  Using cached MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Collecting mccabe==0.7.0 (from -r requirements.txt (line 35))
  Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB)
Collecting mdurl==0.1.2 (from -r requirements.txt (line 36))
  Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting molecule==5.0.1 (from -r requirements.txt (line 37))
  Using cached molecule-5.0.1-py3-none-any.whl (239 kB)
Collecting molecule-plugins==23.4.1 (from -r requirements.txt (line 38))
  Using cached molecule_plugins-23.4.1-py3-none-any.whl (67 kB)
Collecting mypy-extensions==1.0.0 (from -r requirements.txt (line 39))
  Using cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)
Collecting packaging==23.1 (from -r requirements.txt (line 40))
  Using cached packaging-23.1-py3-none-any.whl (48 kB)
Collecting pathspec==0.11.1 (from -r requirements.txt (line 41))
  Using cached pathspec-0.11.1-py3-none-any.whl (29 kB)
Collecting platformdirs==3.5.0 (from -r requirements.txt (line 42))
  Using cached platformdirs-3.5.0-py3-none-any.whl (15 kB)
Collecting pluggy==1.0.0 (from -r requirements.txt (line 43))
  Using cached pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
Collecting pyasn1==0.5.0 (from -r requirements.txt (line 44))
  Using cached pyasn1-0.5.0-py2.py3-none-any.whl (83 kB)
Collecting pycodestyle==2.10.0 (from -r requirements.txt (line 45))
  Using cached pycodestyle-2.10.0-py2.py3-none-any.whl (41 kB)
Collecting pycparser==2.21 (from -r requirements.txt (line 46))
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Collecting pyflakes==3.0.1 (from -r requirements.txt (line 47))
  Using cached pyflakes-3.0.1-py2.py3-none-any.whl (62 kB)
Collecting Pygments==2.15.1 (from -r requirements.txt (line 48))
  Using cached Pygments-2.15.1-py3-none-any.whl (1.1 MB)
Collecting pyhcl==0.4.4 (from -r requirements.txt (line 49))
  Using cached pyhcl-0.4.4-py3-none-any.whl
Collecting pyrsistent==0.19.3 (from -r requirements.txt (line 50))
  Using cached pyrsistent-0.19.3-py3-none-any.whl (57 kB)
Collecting python-dateutil==2.8.2 (from -r requirements.txt (line 51))
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting python-slugify==8.0.1 (from -r requirements.txt (line 52))
  Using cached python_slugify-8.0.1-py2.py3-none-any.whl (9.7 kB)
Collecting PyYAML==5.4.1 (from -r requirements.txt (line 53))
  Using cached PyYAML-5.4.1-cp310-cp310-linux_x86_64.whl
Collecting requests==2.30.0 (from -r requirements.txt (line 54))
  Using cached requests-2.30.0-py3-none-any.whl (62 kB)
Collecting resolvelib==0.8.1 (from -r requirements.txt (line 55))
  Using cached resolvelib-0.8.1-py2.py3-none-any.whl (16 kB)
Collecting rich==13.3.5 (from -r requirements.txt (line 56))
  Using cached rich-13.3.5-py3-none-any.whl (238 kB)
Collecting rsa==4.7.2 (from -r requirements.txt (line 57))
  Using cached rsa-4.7.2-py3-none-any.whl (34 kB)
Collecting ruamel.yaml==0.17.22 (from -r requirements.txt (line 58))
  Using cached ruamel.yaml-0.17.22-py3-none-any.whl (107 kB)
Collecting ruamel.yaml.clib==0.2.7 (from -r requirements.txt (line 59))
  Using cached ruamel.yaml.clib-0.2.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (485 kB)
Collecting s3transfer==0.6.1 (from -r requirements.txt (line 60))
  Using cached s3transfer-0.6.1-py3-none-any.whl (79 kB)
Collecting six==1.16.0 (from -r requirements.txt (line 61))
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting subprocess-tee==0.4.1 (from -r requirements.txt (line 62))
  Using cached subprocess_tee-0.4.1-py3-none-any.whl (5.1 kB)
Collecting text-unidecode==1.3 (from -r requirements.txt (line 63))
  Using cached text_unidecode-1.3-py2.py3-none-any.whl (78 kB)
Collecting tomli==2.0.1 (from -r requirements.txt (line 64))
  Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
Collecting urllib3==1.26.15 (from -r requirements.txt (line 65))
  Using cached urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
Collecting wcmatch==8.4.1 (from -r requirements.txt (line 66))
  Using cached wcmatch-8.4.1-py3-none-any.whl (39 kB)
Collecting yamllint==1.31.0 (from -r requirements.txt (line 67))
  Using cached yamllint-1.31.0-py3-none-any.whl (64 kB)
Installing collected packages: text-unidecode, resolvelib, pyhcl, boto, urllib3, tomli, subprocess-tee, six, ruamel.yaml.clib, PyYAML, python-slugify, pyrsistent, Pygments, pyflakes, pycparser, pycodestyle, pyasn1, pluggy, platformdirs, pathspec, packaging, mypy-extensions, mdurl, mccabe, MarkupSafe, jmespath, idna, filelock, docutils, colorama, click, charset-normalizer, chardet, certifi, bracex, attrs, yamllint, wcmatch, ruamel.yaml, rsa, requests, python-dateutil, markdown-it-py, jsonschema, Jinja2, flake8, click-help-colors, cffi, black, binaryornot, rich, hvac, cryptography, botocore, arrow, s3transfer, jinja2-time, enrich, ansible-core, cookiecutter, boto3, awscli, ansible-lint, ansible-compat, ansible, molecule, molecule-plugins
Successfully installed Jinja2-3.1.2 MarkupSafe-2.1.2 PyYAML-5.4.1 Pygments-2.15.1 ansible-7.5.0 ansible-compat-3.0.2 ansible-core-2.14.5 ansible-lint-6.15.0 arrow-1.2.3 attrs-23.1.0 awscli-1.27.127 binaryornot-0.4.4 black-23.3.0 boto-2.49.0 boto3-1.26.127 botocore-1.29.127 bracex-2.3.post1 certifi-2022.12.7 cffi-1.15.1 chardet-5.1.0 charset-normalizer-3.1.0 click-8.1.3 click-help-colors-0.9.1 colorama-0.4.4 cookiecutter-2.1.1 cryptography-40.0.2 docutils-0.16 enrich-1.2.7 filelock-3.12.0 flake8-6.0.0 hvac-1.1.0 idna-3.4 jinja2-time-0.2.0 jmespath-1.0.1 jsonschema-4.17.3 markdown-it-py-2.2.0 mccabe-0.7.0 mdurl-0.1.2 molecule-5.0.1 molecule-plugins-23.4.1 mypy-extensions-1.0.0 packaging-23.1 pathspec-0.11.1 platformdirs-3.5.0 pluggy-1.0.0 pyasn1-0.5.0 pycodestyle-2.10.0 pycparser-2.21 pyflakes-3.0.1 pyhcl-0.4.4 pyrsistent-0.19.3 python-dateutil-2.8.2 python-slugify-8.0.1 requests-2.30.0 resolvelib-0.8.1 rich-13.3.5 rsa-4.7.2 ruamel.yaml-0.17.22 ruamel.yaml.clib-0.2.7 s3transfer-0.6.1 six-1.16.0 subprocess-tee-0.4.1 text-unidecode-1.3 tomli-2.0.1 urllib3-1.26.15 wcmatch-8.4.1 yamllint-1.31.0

(.venv) $ python -m pip freeze
ansible==7.5.0
ansible-compat==3.0.2
ansible-core==2.14.5
ansible-lint==6.15.0
arrow==1.2.3
attrs==23.1.0
awscli==1.27.127
binaryornot==0.4.4
black==23.3.0
boto==2.49.0
boto3==1.26.127
botocore==1.29.127
bracex==2.3.post1
certifi==2022.12.7
cffi==1.15.1
chardet==5.1.0
charset-normalizer==3.1.0
click==8.1.3
click-help-colors==0.9.1
colorama==0.4.4
cookiecutter==2.1.1
cryptography==40.0.2
docutils==0.16
enrich==1.2.7
filelock==3.12.0
flake8==6.0.0
hvac==1.1.0
idna==3.4
Jinja2==3.1.2
jinja2-time==0.2.0
jmespath==1.0.1
jsonschema==4.17.3
markdown-it-py==2.2.0
MarkupSafe==2.1.2
mccabe==0.7.0
mdurl==0.1.2
molecule==5.0.1
molecule-plugins==23.4.1
mypy-extensions==1.0.0
packaging==23.1
pathspec==0.11.1
platformdirs==3.5.0
pluggy==1.0.0
pyasn1==0.5.0
pycodestyle==2.10.0
pycparser==2.21
pyflakes==3.0.1
Pygments==2.15.1
pyhcl==0.4.4
pyrsistent==0.19.3
python-dateutil==2.8.2
python-slugify==8.0.1
PyYAML==5.4.1
requests==2.30.0
resolvelib==0.8.1
rich==13.3.5
rsa==4.7.2
ruamel.yaml==0.17.22
ruamel.yaml.clib==0.2.7
s3transfer==0.6.1
six==1.16.0
subprocess-tee==0.4.1
text-unidecode==1.3
tomli==2.0.1
urllib3==1.26.15
wcmatch==8.4.1
yamllint==1.31.0

(.venv) $ env | sort
AWS_PROFILE=mycorp-didev
AWS_REGION=us-west-2
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1002/bus
EC2_REGION=us-west-2
HOME=/home/myuser
LANG=en_US.UTF-8
LC_TERMINAL=iTerm2
LC_TERMINAL_VERSION=3.4.19
LESSCLOSE=/usr/bin/lesspipe %s %s
LESSOPEN=| /usr/bin/lesspipe %s
LOGNAME=myuser
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
MOTD_SHOWN=pam
OLDPWD=/home/myuser/projects/ansible
PATH=/home/myuser/projects/ansible/ansible-role-molecule_ec2_template/.venv/bin:/home/myuser/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PS1=(.venv) ${debian_chroot:+($debian_chroot)}\u@\h:\w\$
PWD=/home/myuser/projects/ansible/ansible-role-molecule_ec2_template
SHELL=/bin/bash
SHLVL=0
SSH_CLIENT=10.201.201.249 56119 22
SSH_CONNECTION=10.201.201.249 56119 10.100.232.54 22
SSH_TTY=/dev/pts/0
TERM=ansi
USER=myuser
_=/usr/bin/env
VAULT_ADDR=https://vault.mycorp.com:8200
VAULT_TLS_SERVER_NAME=vault.mycorp.com
VIRTUAL_ENV=/home/myuser/projects/ansible/ansible-role-molecule_ec2_template/.venv
VIRTUAL_ENV_PROMPT=(.venv)
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
XDG_RUNTIME_DIR=/run/user/1002
XDG_SESSION_CLASS=user
XDG_SESSION_ID=515
XDG_SESSION_TYPE=tty

(.venv) $ cat molecule/default/molecule.yml
---
dependency:
  name: galaxy
driver:
  name: ec2
platforms:
   - name: ubuntu-22.04
     image: ami-04861a2e4ef4abd6b  # Ubuntu 22.04 LTS
     instance_type: t2.micro
     vpc_subnet_id: subnet-01eb1db29e0209d48
     assign_public_ip: false
     ansible_user: ubuntu
provisioner:
  name: ansible
verifier:
  name: ansible

(.venv) $ molecule destroy
INFO     Found config file /home/myuser/projects/ansible/ansible-role-molecule_ec2_template/.config/molecule/config.yml
WARNING  The scenario config file ('/home/myuser/projects/ansible/ansible-role-molecule_ec2_template/molecule/default/molecule.yml') has been modified since the scenario was created. If recent changes are important, reset the scenario with 'molecule destroy' to clean up created items or 'molecule reset' to clear current configuration.
WARNING  Driver ec2 does not provide a schema.
INFO     default scenario test matrix: dependency, cleanup, destroy
INFO     Performing prerun with role_name_check=0...
INFO     Set ANSIBLE_LIBRARY=/home/myuser/.cache/ansible-compat/30597c/modules:/home/myuser/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/myuser/.cache/ansible-compat/30597c/collections:/home/myuser/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/myuser/.cache/ansible-compat/30597c/roles:/home/myuser/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Using /home/myuser/.cache/ansible-compat/30597c/roles/mycorp.molecule_ec2 symlink to current repository in order to enable Ansible to find the role using its expected full name.
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Validate platform configurations] ****************************************
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/run-config.yml' in expected paths (use -vvvvv to
see paths)
ok: [localhost] => (item=ubuntu-22.04)

TASK [Look up subnets to determine VPCs (if needed)] ***************************
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/run-config.yml' in expected paths (use -vvvvv to
see paths)
[DEPRECATION WARNING]: Support for the 'EC2_REGION', 'EC2_ACCESS_KEY',
'EC2_SECRET_KEY', 'EC2_SECURITY_TOKEN', 'EC2_URL', and 'S3_URL' environment
variables has been deprecated.  These variables are currently used for all AWS
services which can cause confusion.  We recomend using the relevant module
parameters or alternatively the 'AWS_REGION', 'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY', 'AWS_SESSION_TOKEN', and 'AWS_URL' environment
variables can be used instead. This feature will be removed from amazon.aws in
a release after 2024-12-01. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
ok: [localhost] => (item=ubuntu-22.04)

TASK [Validate discovered information] *****************************************
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/run-config.yml' in expected paths (use -vvvvv to
see paths)
ok: [localhost] => (item=ubuntu-22.04)

TASK [Destroy ephemeral EC2 instances] *****************************************
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/run-config.yml' in expected paths (use -vvvvv to
see paths)
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/instance_config.yml' in expected paths (use
-vvvvv to see paths)
changed: [localhost] => (item=ubuntu-22.04)

TASK [Wait for instance destruction to complete] *******************************
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/run-config.yml' in expected paths (use -vvvvv to
see paths)
failed: [localhost] (item=ubuntu-22.04) => {"ansible_index_var": "index", "ansible_job_id": "j368239605520.381935", "ansible_loop_var": "item", "attempts": 2, "changed": false, "cmd": "/home/myuser/.ansible/tmp/ansible-tmp-1683388151.8528783-381915-266859886423936/AnsiballZ_ec2_instance.py", "data": "", "finished": 1, "index": 0, "item": {"ansible_job_id": "j368239605520.381935", "ansible_loop_var": "item", "changed": true, "failed": 0, "finished": 0, "item": {"ansible_user": "ubuntu", "assign_public_ip": false, "aws_profile": "mycorp-didev", "image": "ami-04861a2e4ef4abd6b", "instance_type": "t2.micro", "key_inject_method": "cloud-init", "key_name": "molecule-cvgsj", "name": "ubuntu-22.04", "region": "us-west-2", "security_group_name": "molecule-ipbvs", "security_groups": [], "vpc_id": "", "vpc_subnet_id": "subnet-01eb1db29e0209d48"}, "results_file": "/home/myuser/.ansible_async/j368239605520.381935", "started": 1}, "msg": "Traceback (most recent call last):\n  File \"/tmp/ansible_ansible.legacy.async_wrapper_payload_c4bwbmz4/ansible_ansible.legacy.async_wrapper_payload.zip/ansible/modules/async_wrapper.py\", line 180, in _run_module\n  File \"/tmp/ansible_ansible.legacy.async_wrapper_payload_c4bwbmz4/ansible_ansible.legacy.async_wrapper_payload.zip/ansible/modules/async_wrapper.py\", line 98, in _filter_non_json_lines\nValueError: No start of json char found\n", "results_file": "/home/myuser/.ansible_async/j368239605520.381935", "started": 1, "stderr": "Traceback (most recent call last):\n  File \"/home/myuser/.ansible/tmp/ansible-tmp-1683388151.8528783-381915-266859886423936/AnsiballZ_ec2_instance.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/myuser/.ansible/tmp/ansible-tmp-1683388151.8528783-381915-266859886423936/AnsiballZ_ec2_instance.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/myuser/.ansible/tmp/ansible-tmp-1683388151.8528783-381915-266859886423936/AnsiballZ_ec2_instance.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.ec2_instance', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.ec2_instance', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 2167, in <module>\n  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 2141, in main\n  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 2018, in build_filters\n  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 1566, in get_default_subnet\nTypeError: 'NoneType' object is not subscriptable\n", "stderr_lines": ["Traceback (most recent call last):", "  File \"/home/myuser/.ansible/tmp/ansible-tmp-1683388151.8528783-381915-266859886423936/AnsiballZ_ec2_instance.py\", line 107, in <module>", "    _ansiballz_main()", "  File \"/home/myuser/.ansible/tmp/ansible-tmp-1683388151.8528783-381915-266859886423936/AnsiballZ_ec2_instance.py\", line 99, in _ansiballz_main", "    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)", "  File \"/home/myuser/.ansible/tmp/ansible-tmp-1683388151.8528783-381915-266859886423936/AnsiballZ_ec2_instance.py\", line 47, in invoke_module", "    runpy.run_module(mod_name='ansible_collections.amazon.aws.plugins.modules.ec2_instance', init_globals=dict(_module_fqn='ansible_collections.amazon.aws.plugins.modules.ec2_instance', _modlib_path=modlib_path),", "  File \"/usr/lib/python3.10/runpy.py\", line 224, in run_module", "    return _run_module_code(code, init_globals, run_name, mod_spec)", "  File \"/usr/lib/python3.10/runpy.py\", line 96, in _run_module_code", "    _run_code(code, mod_globals, init_globals,", "  File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code", "    exec(code, run_globals)", "  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 2167, in <module>", "  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 2141, in main", "  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 2018, in build_filters", "  File \"/tmp/ansible_ec2_instance_payload_ga1x__vo/ansible_ec2_instance_payload.zip/ansible_collections/amazon/aws/plugins/modules/ec2_instance.py\", line 1566, in get_default_subnet", "TypeError: 'NoneType' object is not subscriptable"], "stdout": "", "stdout_lines": []}
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (300 retries left).

PLAY RECAP *********************************************************************
localhost                  : ok=4    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

WARNING  Retrying execution failure 2 of: ansible-playbook --inventory /home/myuser/.cache/molecule/ansible-role-molecule_ec2_template/default/inventory --skip-tags molecule-notest,notest /home/myuser/projects/ansible/ansible-role-molecule_ec2_template/molecule/default/destroy.yml
CRITICAL Ansible return code was 2, command was: ['ansible-playbook', '--inventory', '/home/myuser/.cache/molecule/ansible-role-molecule_ec2_template/default/inventory', '--skip-tags', 'molecule-notest,notest', '/home/myuser/projects/ansible/ansible-role-molecule_ec2_template/molecule/default/destroy.yml']

(.venv) $ molecule create
INFO     Found config file /home/myuser/projects/ansible/ansible-role-molecule_ec2_template/.config/molecule/config.yml
WARNING  The scenario config file ('/home/myuser/projects/ansible/ansible-role-molecule_ec2_template/molecule/default/molecule.yml') has been modified since the scenario was created. If recent changes are important, reset the scenario with 'molecule destroy' to clean up created items or 'molecule reset' to clear current configuration.
WARNING  Driver ec2 does not provide a schema.
INFO     default scenario test matrix: dependency, create, prepare
INFO     Performing prerun with role_name_check=0...
INFO     Set ANSIBLE_LIBRARY=/home/myuser/.cache/ansible-compat/30597c/modules:/home/myuser/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/myuser/.cache/ansible-compat/30597c/collections:/home/myuser/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/myuser/.cache/ansible-compat/30597c/roles:/home/myuser/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Using /home/myuser/.cache/ansible-compat/30597c/roles/mycorp.molecule_ec2 symlink to current repository in order to enable Ansible to find the role using its expected full name.
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > create

PLAY [Create] ******************************************************************

TASK [Validate platform configurations] ****************************************
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/run-config.yml' in expected paths (use -vvvvv to
see paths)
ok: [localhost] => (item=ubuntu-22.04)

TASK [Write run config to file] ************************************************
[WARNING]: Unable to find '/home/myuser/.cache/molecule/ansible-role-
molecule_ec2_template/default/run-config.yml' in expected paths (use -vvvvv to
see paths)
changed: [localhost]

TASK [Generate local key pairs] ************************************************
changed: [localhost] => (item=ubuntu-22.04)

TASK [Look up EC2 AMI(s) by owner and name (if image not set)] *****************
skipping: [localhost] => (item=ubuntu-22.04)
skipping: [localhost]

TASK [Look up subnets to determine VPCs (if needed)] ***************************
[DEPRECATION WARNING]: Support for the 'EC2_REGION', 'EC2_ACCESS_KEY',
'EC2_SECRET_KEY', 'EC2_SECURITY_TOKEN', 'EC2_URL', and 'S3_URL' environment
variables has been deprecated.  These variables are currently used for all AWS
services which can cause confusion.  We recomend using the relevant module
parameters or alternatively the 'AWS_REGION', 'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY', 'AWS_SESSION_TOKEN', and 'AWS_URL' environment
variables can be used instead. This feature will be removed from amazon.aws in
a release after 2024-12-01. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
ok: [localhost] => (item=ubuntu-22.04)

TASK [Validate discovered information] *****************************************
ok: [localhost] => (item=ubuntu-22.04)

TASK [Create ephemeral EC2 keys (if needed)] ***********************************
skipping: [localhost] => (item=ubuntu-22.04)
skipping: [localhost]

TASK [Create ephemeral security groups (if needed)] ****************************
changed: [localhost] => (item=ubuntu-22.04)

TASK [Create ephemeral EC2 instance(s)] ****************************************
changed: [localhost] => (item=ubuntu-22.04)

TASK [Wait for instance creation to complete] **********************************
FAILED - RETRYING: [localhost]: Wait for instance creation to complete (300 retries left).
FAILED - RETRYING: [localhost]: Wait for instance creation to complete (299 retries left).
FAILED - RETRYING: [localhost]: Wait for instance creation to complete (298 retries left).
FAILED - RETRYING: [localhost]: Wait for instance creation to complete (297 retries left).
FAILED - RETRYING: [localhost]: Wait for instance creation to complete (296 retries left).
FAILED - RETRYING: [localhost]: Wait for instance creation to complete (295 retries left).
FAILED - RETRYING: [localhost]: Wait for instance creation to complete (294 retries left).
changed: [localhost] => (item=ubuntu-22.04)

TASK [Collect instance configs] ************************************************
ok: [localhost] => (item=ubuntu-22.04)

TASK [Write Molecule instance configs] *****************************************
changed: [localhost]

TASK [Start SSH pollers] *******************************************************
changed: [localhost] => (item=ubuntu-22.04)

TASK [Wait for SSH] ************************************************************
[WARNING]: The 'finished' test expects an async task, but a non-async task was
tested
ok: [localhost] => (item=ubuntu-22.04)

TASK [Wait for boot process to finish] *****************************************
Pausing for 120 seconds
(ctrl+C then 'C' = continue early, ctrl+C then 'A' = abort)
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=13   changed=7    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0

INFO     Running default > prepare

PLAY [Prepare] *****************************************************************

TASK [Make sure python3 is installed] ******************************************
ok: [ubuntu-22.04]

PLAY RECAP *********************************************************************
ubuntu-22.04               : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

(.venv) $ molecule destroy
INFO     Found config file /home/myuser/projects/ansible/ansible-role-molecule_ec2_template/.config/molecule/config.yml
WARNING  The scenario config file ('/home/myuser/projects/ansible/ansible-role-molecule_ec2_template/molecule/default/molecule.yml') has been modified since the scenario was created. If recent changes are important, reset the scenario with 'molecule destroy' to clean up created items or 'molecule reset' to clear current configuration.
WARNING  Driver ec2 does not provide a schema.
INFO     default scenario test matrix: dependency, cleanup, destroy
INFO     Performing prerun with role_name_check=0...
INFO     Set ANSIBLE_LIBRARY=/home/myuser/.cache/ansible-compat/30597c/modules:/home/myuser/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/myuser/.cache/ansible-compat/30597c/collections:/home/myuser/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/myuser/.cache/ansible-compat/30597c/roles:/home/myuser/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Using /home/myuser/.cache/ansible-compat/30597c/roles/mycorp.molecule_ec2 symlink to current repository in order to enable Ansible to find the role using its expected full name.
INFO     Running default > dependency
WARNING  Skipping, missing the requirements file.
WARNING  Skipping, missing the requirements file.
INFO     Running default > cleanup
WARNING  Skipping, cleanup playbook not configured.
INFO     Running default > destroy

PLAY [Destroy] *****************************************************************

TASK [Validate platform configurations] ****************************************
ok: [localhost] => (item=ubuntu-22.04)

TASK [Look up subnets to determine VPCs (if needed)] ***************************
[DEPRECATION WARNING]: Support for the 'EC2_REGION', 'EC2_ACCESS_KEY',
'EC2_SECRET_KEY', 'EC2_SECURITY_TOKEN', 'EC2_URL', and 'S3_URL' environment
variables has been deprecated.  These variables are currently used for all AWS
services which can cause confusion.  We recomend using the relevant module
parameters or alternatively the 'AWS_REGION', 'AWS_ACCESS_KEY_ID',
'AWS_SECRET_ACCESS_KEY', 'AWS_SESSION_TOKEN', and 'AWS_URL' environment
variables can be used instead. This feature will be removed from amazon.aws in
a release after 2024-12-01. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
ok: [localhost] => (item=ubuntu-22.04)

TASK [Validate discovered information] *****************************************
ok: [localhost] => (item=ubuntu-22.04)

TASK [Destroy ephemeral EC2 instances] *****************************************
changed: [localhost] => (item=ubuntu-22.04)

TASK [Wait for instance destruction to complete] *******************************
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (300 retries left).
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (299 retries left).
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (298 retries left).
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (297 retries left).
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (296 retries left).
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (295 retries left).
FAILED - RETRYING: [localhost]: Wait for instance destruction to complete (294 retries left).
changed: [localhost] => (item=ubuntu-22.04)

TASK [Write Molecule instance configs] *****************************************
changed: [localhost]

TASK [Destroy ephemeral security groups (if needed)] ***************************
changed: [localhost] => (item=ubuntu-22.04)

TASK [Destroy ephemeral keys (if needed)] **************************************
skipping: [localhost] => (item=ubuntu-22.04)
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=7    changed=4    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

INFO     Pruning extra files from scenario ephemeral directory
@danielpodwysocki
Copy link
Contributor

Seems to duplicate #46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant