appsembler / roles

Curated Ansible roles with an emphasis on sane defaults, extensibility, and reusability.
MIT License
0 stars 2 forks source link

google-fluentd looking for non-existent redis.conf file #68

Open tkeemon opened 4 years ago

tkeemon commented 4 years ago

Running the google-fluentd role on a Wharfhouse node produced this error:

TASK [google-fluentd : Copy custom configurations] *************************************************************

TASK [google-fluentd : Copy custom configurations] *************************************************************
changed: [35.237.211.232] => (item=apt_history.conf)
changed: [35.237.211.232] => (item=authlog.conf)
changed: [35.237.211.232] => (item=kernlog.conf)
changed: [35.237.211.232] => (item=letsencrypt.conf)
failed: [35.237.211.232] (item=redis.conf) => {"ansible_loop_var": "item", "changed": false, "item": "redis.conf", "msg": "Could not find or access 'redis.conf'\nSearched in:\n\t/home/tj/Programming/wharf/wharf/deploy/appsembler_roles/google-fluentd/templates/redis.conf\n\t/home/tj/Programming/wharf/wharf/deploy/appsembler_roles/google-fluentd/redis.conf\n\t/home/tj/Programming/wharf/wharf/deploy/appsembler_roles/google-fluentd/tasks/templates/redis.conf\n\t/home/tj/Programming/wharf/wharf/deploy/appsembler_roles/google-fluentd/tasks/redis.conf\n\t/home/tj/Programming/wharf/wharf/deploy/templates/redis.conf\n\t/home/tj/Programming/wharf/wharf/deploy/redis.conf on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

I'm on the latest commit on develop: https://github.com/appsembler/roles/commit/cde4edefb9578849d6bcc54c7628486882e132df

I think there are two issues here. First, there are two tasks with the same name: https://github.com/appsembler/roles/blob/cde4edefb9578849d6bcc54c7628486882e132df/google-fluentd/tasks/main.yml#L31-L43

In my experience, this causes Ansible to silently skip the first task (which it looks like happened here). If the older task isn't needed, then it should probably be deleted.

I'm having more trouble figuring out what's happening with the second issue (the actual failure). It looks like Ansible is looking locally for a redis.conf file and not finding it. I'm not sure why Ansible is looking for that file because there's no template with that name in the repo: https://github.com/appsembler/roles/tree/develop/google-fluentd/templates

I'm not sure how google_fluent_custom_config_templates is being set in the first place because its default value is an empty list: https://github.com/appsembler/roles/blob/cde4edefb9578849d6bcc54c7628486882e132df/google-fluentd/defaults/main.yml#L8 and we're not overriding that anywhere in the Wharf repo.

One thing worth noting is that the remote directory the config files are supposed to be copied into is full of files not created by Ansible:

tj@prod-itential-wharfhouse-5:~$ vi /etc/google-fluentd/config.d/
apache.conf             letsencrypt.conf        redis.conf
apt_history.conf        magento.conf            redmine.conf
authlog.conf            mediawiki.conf          salt.conf
cassandra.conf          memcached.conf          solr.conf
chef.conf               mongodb.conf            sugarcrm.conf
forward.conf            mysql.conf              syslog.conf
gitlab.conf             nginx.conf              syslog_endpoint.conf
jenkins.conf            postgresql.conf         tomcat.conf
jetty.conf              puppet.conf             zookeeper.conf
joomla.conf             puppet-enterprise.conf  
kernlog.conf            rabbitmq.conf           
thraxil commented 4 years ago

@tkeemon wharf is setting google_fluent_custom_config_templates here: https://github.com/appsembler/wharf/blob/develop/deploy/base_vars/all#L47

thraxil commented 4 years ago

Also, the first task is running, it just doesn't do anything because google_fluent_custom_config_files is an empty list. I've never seen ansible skip a task based on the name.