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

Error message about java_home #3

Closed
dj-wasabi opened this issue Dec 14, 2014 · 4 comments
Closed

Error message about java_home #3

dj-wasabi opened this issue Dec 14, 2014 · 4 comments

Comments

@dj-wasabi
Copy link

Hi there,

I'm trying to setup the module, but I think I'm or doing wrong or I forget someting.
Ik get the following error message:

TASK: [groover.tomcat | Install sysvinit Tomcat Service] ********************** 
fatal: [wdserver00] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'java_home' is undefined", 'failed': True}
fatal: [wdserver00] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'java_home' is undefined", 'failed': True}

I did setup the facts file:

[root@server ~]# cat /etc/ansible/facts.d/java.fact
[default]
java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64
[general]
java_home=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64

When I run the setup:

ansible server -i etc/host_list -m setup -a "filter=ansible_local"
server | success >> {
    "ansible_facts": {
        "ansible_local": {
            "java": {
                "default": {
                    "java_home": "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64"
                }, 
                "general": {
                    "java_home": "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.71.x86_64"
                }
            }
        }
    }, 
    "changed": false
}

The directories does exists though...

What am I doing wrong or missing?

Kind regards,
Werner

@ghost
Copy link

ghost commented Dec 15, 2014

Hi, this is currently a design flaw in the role. java_home fact is not available to the tomcat role, if groover.java is not part of the playbook. java_home is set with set_fact in groover.java. Tomcat role should use ansible_local['java']['general']['java_home'] as your facts already told you.

@dj-wasabi
Copy link
Author

Thanks. I've added the groovy.java rol and it is working now.

@ghost
Copy link

ghost commented Jan 6, 2015

Hi, just updated tomcat role to version 0.5.0. This uses the java local facts now in any template. This allows to either configure /etc/ansible/facts.d/java.fact manually and have the tomcat role working without implicit dependencies to the groover.java role, or to have a dependency to groover.java without the need to have the java role run in each play (e.g. using --tags tomcat).

@dj-wasabi
Copy link
Author

Sounds good! Will check it out, thanks for this update!

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