Giter Club home page Giter Club logo

ansible-module-gce-facts's People

Contributors

br0ziliy avatar

Watchers

 avatar  avatar  avatar

ansible-module-gce-facts's Issues

Error parsing ssh keys (was: Still alive?)

Is this module still alive?
Ansible 2.5 gets the following error:
"module_stdout": "Traceback (most recent call last):\r\n File "/tmp/ansible_m4gyRe/ansible_module_gce_facts.py", line 105, in \r\n main()\r\n File "/tmp/ansible_m4gyRe/ansible_module_gce_facts.py", line 96, in main\r\n gce_facts = GceMetadata(module).run()\r\n File "/tmp/ansible_m4gyRe/ansible_module_gce_facts.py", line 85, in run\r\n data = self._mangle_data(self._data)\r\n File "/tmp/ansible_m4gyRe/ansible_module_gce_facts.py", line 77, in _mangle_data\r\n ssh_keys = data['ansible_gce']['project']['attributes']['sshKeys']\r\nKeyError: 'sshKeys'\r\n",
"msg": "MODULE FAILURE",
"rc": 0

Please Add A License

There is currently no license specified so this project defaults to full copyright by owner. In order to make it possible for others to use your work please consider specifying which license you would like this to be governed by.

Thank you for your work on this!

Error parsing custom attributes with dashes

I get an error when I try to get the value of custom metadata attribute with an underscore in the key name. underscores work fine. Example below:
Excerpt from gce_facts output:

"ansible_facts": {
        "ansible_gce": {
            "instance": {
                "attributes": {
                    "my-customkey2": "my-customvalue2", 
                    "my_customkey1": "my_customvalue1", 
                    "my_customkey3": "my_customvalue3", 
                    "serial-port-enable": "true",                     
                }, 

playbook:

- debug:
    msg: "{{ ansible_gce.instance.attributes.my_customkey1 }}"
- debug:
    msg: "{{ ansible_gce.instance.attributes.my_customkey3 }}"
- debug:
    msg: "{{ ansible_gce.instance.attributes.my-customkey2 }}"

Error I receive when I run the playbook:

TASK [gce_labels : debug] *****************************************************************************************************************************************************************************************
ok: [hostname.example.com] => {
    "msg": "my_customvalue1"
}

TASK [gce_labels : debug] *****************************************************************************************************************************************************************************************
ok: [hostname.example.com] => {
    "msg": "my_customvalue3"
}

TASK [gce_labels : debug] *****************************************************************************************************************************************************************************************
fatal: [hostname.example.com]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: Unable to look up a name or access an attribute in template string ({{ ansible_gce.instance.attributes.my-customkey2 }}).\nMake sure your variable name does not contain invalid characters like '-': unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'\n\nThe error appears to have been in '/etc/ansible/roles/gce_labels/tasks/main.yml': line 22, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n    msg: \"{{ ansible_gce.instance.attributes.my_customkey3 }}\"\n- debug:\n  ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: Unable to look up a name or access an attribute in template string ({{ ansible_gce.instance.attributes.my-customkey2 }}).\nMake sure your variable name does not contain invalid characters like '-': unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.