0

I have a very simple script in /etc/ansible/facts.d which is used to discover the local SSL certs on a host. This is the code:

#!/bin/sh

echo "{
  \"testkey\": \"testvalue\",
  \"crt\": \"$(/usr/bin/base64 -w 0 /etc/kubernetes/pki/apiserver.crt)\",
  \"key\": \"$(/usr/bin/base64 -w 0 /etc/kubernetes/pki/apiserver.key)\"
}"

When I run it myself with $> /etc/ansible/facts.d/apiserver_ssl_facts.fact it outputs all the values as expected. But when Ansible runs it only the testkey has a value, while the others are an empty string "":

ansible@bastion-1:~/ansible$ ansible -m setup <host> -a "filter=ansible_local"
<host> | SUCCESS => {
    "ansible_facts": {
        "ansible_local": {
            "apiserver_ssl_facts": {
                "crt": "", 
                "key": "", 
                "testkey": "testvalue"
            }
        }
    }, 
    "changed": false
}

Running Ansible in very verbose with -vvvv does not show any errors.

2
  • 1
    Does ansible user has access to those files? May 24, 2017 at 12:50
  • @KonstantinSuvorov douh, you're right, that's it. if you want you can post it as answer, then i'll accept
    – replay
    May 24, 2017 at 12:52

1 Answer 1

1

Answer from the comments: there is a permission issue, so the ansible user can't access cert files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .