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

roles/mongodb/tasks/providers/aws/install.yml fails to set az in "Set Fact for availability zones" task #1510

Open
texkelly opened this issue Oct 9, 2024 · 2 comments
Labels
Bug Report Something isn't working

Comments

@texkelly
Copy link

texkelly commented Oct 9, 2024

Collection version

23.1.1

Environment information

bkelly@Brendans-M1-MBP-5 tas % ansible --version
ansible [core 2.17.3]
  config file = None
  configured module search path = ['/Users/bkelly/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/10.3.0/libexec/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/bkelly/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.12.6 (main, Sep  6 2024, 19:03:47) [Clang 15.0.0 (clang-1500.3.9.4)] (/opt/homebrew/Cellar/ansible/10.3.0/libexec/bin/python)
  jinja version = 3.1.4
  libyaml = True
bkelly@Brendans-M1-MBP-5 tas % python --version
zsh: command not found: python
bkelly@Brendans-M1-MBP-5 tas % python3 --version
Python 3.12.6
bkelly@Brendans-M1-MBP-5 tas % python3 -m pip list
Package            Version
------------------ --------
certifi            None
cffi               1.17.0
cryptography       None
docutils           0.20.1
gpg                1.23.2
libvirt-python     10.5.0
numpy              None
openvino           2024.2.0
openvino-telemetry 2023.2.1
packaging          24.0
pip                24.2
pycairo            1.26.1
pycparser          2.22
PyGObject          3.48.2
pyparsing          3.1.1
setuptools         69.0.2
TBB                0.2
wheel              0.44.0

What happened?

tried to install documentDB in AWS using following task:

- name: DocumentDB
  vars:
    mas_instance_id: "{{ tas_instance_name }}"
    mas_config_dir: tasconfig
    mongodb_provider: aws
    docdb_security_group_name: sg-0380ba5beebcc3e6f
    docdb_cluster_name: "{{ cluster_name }}-docdb"
    docdb_ingress_cidr: 10.0.0.0/16
    docdb_egress_cidr: 10.0.0.0/16
    docdb_cidr_az1: 10.0.3.0/26
    docdb_cidr_az2: 10.0.3.64/26
    docdb_cidr_az3: 10.0.3.128/26
    docdb_instance_identifier_prefix: "{{ cluster_name }}-docdb"
    vpc_id: vpc-0a8121df5ade686c9
    aws_region: us-east-1
    aws_access_key_id: xxx
    aws_secret_access_key: yyy
  include_role:
    name: ibm.mas_devops.mongodb

Relevant log output

TASK [ibm.mas_devops.mongodb : Set Fact for availability zones] *********************************************************************
fatal: [localhost]: FAILED! => {"msg": "the field 'args' has an invalid value ({'az': \"{{ az_info.stdout | from_json | json_query('AvailabilityZones') }}\"}), and could not be converted to dict. The error was: Expecting value: line 1 column 1 (char 0)\n\nThe error appears to be in '/Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml': line 59, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set Fact for availability zones\n  ^ here\n"}

bkelly@Brendans-M1-MBP-5 ~ % aws ec2 describe-availability-zones
AVAILABILITYZONES       us-east-1       us-east-1       opt-in-not-required     us-east-1       available       use1-az1        us-east-1a   availability-zone
AVAILABILITYZONES       us-east-1       us-east-1       opt-in-not-required     us-east-1       available       use1-az2        us-east-1b   availability-zone
AVAILABILITYZONES       us-east-1       us-east-1       opt-in-not-required     us-east-1       available       use1-az4        us-east-1c   availability-zone
AVAILABILITYZONES       us-east-1       us-east-1       opt-in-not-required     us-east-1       available       use1-az6        us-east-1d   availability-zone
AVAILABILITYZONES       us-east-1       us-east-1       opt-in-not-required     us-east-1       available       use1-az3        us-east-1e   availability-zone
AVAILABILITYZONES       us-east-1       us-east-1       opt-in-not-required     us-east-1       available       use1-az5        us-east-1f   availability-zone
@texkelly texkelly added the Bug Report Something isn't working label Oct 9, 2024
@texkelly
Copy link
Author

Upgraded ansible to latest in brew (2.17.5) made no difference

@texkelly
Copy link
Author

higher debug level:
TASK [DocumentDB] *******************************************************************************************************************
task path: /Users/bkelly/ibm-tas/tas/deploy-tas-in-rosa-part1.yaml:25
included: ibm.mas_devops.mongodb for localhost

TASK [ibm.mas_devops.ansible_version_check : Verify minimum Ansible version is 2.10.3] **********************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/ansible_version_check/tasks/main.yml:1
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}

TASK [ibm.mas_devops.mongodb : Fail if mongodb_provider is not provided] ************************************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/main.yml:4
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}

TASK [ibm.mas_devops.mongodb : include_tasks] ***************************************************************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/main.yml:11
included: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml for localhost

TASK [ibm.mas_devops.mongodb : Fail if var docdb_cluster_name not provided for DocDB provisioning] **********************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml:2
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}

TASK [ibm.mas_devops.mongodb : Fail if var vpc_id not provided for DocDB provisioning] **********************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml:7
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}

TASK [ibm.mas_devops.mongodb : Fail if required vars for DocDB not provided] ********************************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml:12
ok: [localhost] => {
"changed": false,
"msg": "All assertions passed"
}

TASK [ibm.mas_devops.mongodb : Initialize Facts for provisioning] *******************************************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml:25
ok: [localhost] => {
"ansible_facts": {
"docdb_cluster_exists": false,
"subnet_group_exists": false,
"subnet_id_list": []
},
"changed": false
}

TASK [ibm.mas_devops.mongodb : Debug properties, Provider: aws Action: install] *****************************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml:31
ok: [localhost] => {
"msg": [
"VPC ID ................................. vpc-0a8121df5ade686c9",
"DocumentDB Cluster Name ................ tas-mzr-perftst-docdb",
"DocumentDB Instance Name Prefix ........ tas-mzr-perftst-docdb",
"Number of Instances for DocumentDB ..... 3",
"DocumentDB Instance Class .............. db.t3.medium",
"DocumentDB Engine Version .............. 4.0.0",
"DocumentDB Master Username ............. docdbadmin",
"DocumentDB Subnet Group Name ........... docdb-tas-mzr-perftst-docdb",
"DocumentDB Security Group Name ......... sg-0380ba5beebcc3e6f",
"DocumentDB Admin credential Secret ..... sg-0380ba5beebcc3e6f",
"CIDR Block for Subnet 1 ................ 10.0.3.0/26",
"CIDR Block for Subnet 2 ................ 10.0.3.64/26",
"CIDR Block for Subnet 3 ................ 10.0.3.128/26",
"Allow incoming traffic from CIDR block . 10.0.0.0/16",
"Allow outgoing traffic to CIDR block ... 10.0.0.0/16",
"MAS instance ID ........................ mzr-perf1",
"MAS config directory ................... tasconfig"
]
}

TASK [ibm.mas_devops.mongodb : Fetch availability Zones in VPC Reigon] **************************************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml:54
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: bkelly
<127.0.0.1> EXEC /bin/sh -c 'echo ~bkelly && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /Users/bkelly/.ansible/tmp"&& mkdir "echo /Users/bkelly/.ansible/tmp/ansible-tmp-1728518810.692065-42019-193793056184459" && echo ansible-tmp-1728518810.692065-42019-193793056184459="echo /Users/bkelly/.ansible/tmp/ansible-tmp-1728518810.692065-42019-193793056184459" ) && sleep 0'
Using module file /opt/homebrew/Cellar/ansible/10.5.0/libexec/lib/python3.12/site-packages/ansible/modules/command.py
<127.0.0.1> PUT /Users/bkelly/.ansible/tmp/ansible-local-419408tu7vd_g/tmpbfatl903 TO /Users/bkelly/.ansible/tmp/ansible-tmp-1728518810.692065-42019-193793056184459/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/bkelly/.ansible/tmp/ansible-tmp-1728518810.692065-42019-193793056184459/ /Users/bkelly/.ansible/tmp/ansible-tmp-1728518810.692065-42019-193793056184459/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/opt/homebrew/Cellar/ansible/10.5.0/libexec/bin/python /Users/bkelly/.ansible/tmp/ansible-tmp-1728518810.692065-42019-193793056184459/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/bkelly/.ansible/tmp/ansible-tmp-1728518810.692065-42019-193793056184459/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
"changed": true,
"cmd": [
"aws",
"ec2",
"describe-availability-zones"
],
"delta": "0:00:01.742366",
"end": "2024-10-10 10:06:52.652294",
"invocation": {
"module_args": {
"_raw_params": "aws ec2 describe-availability-zones\n",
"_uses_shell": false,
"argv": null,
"chdir": null,
"creates": null,
"executable": null,
"expand_argument_vars": true,
"removes": null,
"stdin": null,
"stdin_add_newline": true,
"strip_empty_ends": true
}
},
"msg": "",
"rc": 0,
"start": "2024-10-10 10:06:50.909928",
"stderr": "",
"stderr_lines": [],
"stdout": "AVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az1\tus-east-1a\tavailability-zone\nAVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az2\tus-east-1b\tavailability-zone\nAVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az4\tus-east-1c\tavailability-zone\nAVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az6\tus-east-1d\tavailability-zone\nAVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az3\tus-east-1e\tavailability-zone\nAVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az5\tus-east-1f\tavailability-zone",
"stdout_lines": [
"AVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az1\tus-east-1a\tavailability-zone",
"AVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az2\tus-east-1b\tavailability-zone",
"AVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az4\tus-east-1c\tavailability-zone",
"AVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az6\tus-east-1d\tavailability-zone",
"AVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az3\tus-east-1e\tavailability-zone",
"AVAILABILITYZONES\tus-east-1\tus-east-1\topt-in-not-required\tus-east-1\tavailable\tuse1-az5\tus-east-1f\tavailability-zone"
]
}

TASK [ibm.mas_devops.mongodb : Set Fact for availability zones] *********************************************************************
task path: /Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml:59
redirecting (type: filter) ansible.builtin.json_query to community.general.json_query
fatal: [localhost]: FAILED! => {
"msg": "the field 'args' has an invalid value ({'az': "{{ az_info.stdout | from_json | json_query('AvailabilityZones') }}"}), and could not be converted to dict.. Expecting value: line 1 column 1 (char 0)\n\nThe error appears to be in '/Users/bkelly/.ansible/collections/ansible_collections/ibm/mas_devops/roles/mongodb/tasks/providers/aws/install.yml': line 59, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set Fact for availability zones\n ^ here\n"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant