ricbra / ansible-logentries Goto Github PK
View Code? Open in Web Editor NEWAnsible role for installing logentries agent and daemon
Ansible role for installing logentries agent and daemon
If you have someone that deleted the host (on logentries), while this should not be the case it will not reregister. The register command will fail with:
Warning: Server already registered. Use --force to override current registration.
So you could do a catch on that and "re-register", if i read it correctly, something like:
when: "'already registered' in result_register.stderr"
As a note, if you don't have the latest ansible extra modules, the "name" entry will fail. Was updated at some point, but mine came with an older version it seemed.
Is it possible to follow all log files in a directory.
For an example app logs - app/storage/logs/* ( Multiple files , file name depends on date etc )
Useful if folks want to change the hostname config var if re-deploying, no? Right now it only sets this when: result|failed and logentries_set_key is not defined
- name: Register host shell: "le register --force --name={{ logentries_hostname | default(ansible_fqdn) }} --hostname={{ logentries_hostname | default(ansible_fqdn) }} --yes --account-key={{ logentries_account_key }}" when: result|failed and logentries_set_key is not defined
Hey Richard,
Cheers for putting this together :) Would you mind if we reference to this page on our documentation? We haven't done anything for Ansible and I think it would be pretty cool to write up some instructions and reference you!
Hey there. I noticed that is the service is stopped for some reason, there's no way to make sure it is indeed started. We have a "Restart logentries" handler but that's only triggered for things like config updates.
Am I missing something or can maybe someone help me figure out where to place a task to ensure the service is started after the step to "Follow logs"?
Maybe something like this, or?
- name: Ensure logentries service started if stopped
service: name={{ logentries_service }} state=started
Thanks.
Would be nice to have this feature in case the agent hostname changes.
What about something like this?
- name: Check current agent hostname
shell: "sudo le whoami | grep hostname"
register: result
ignore_errors: true
changed_when: false
when: logentries_hostname is defined
- name: Re-register hostname if it has changed
shell: "le register --force --hostname={{ logentries_hostname }}"
when: logentries_hostname is defined and result.stdout != "hostname = {{ logentries_hostname }}"
Specifiying method: keyserver
in the apt-key task is no longer valid, results in errors like
failed: [master] => (item={u'id': u'C43C79AD', u'value': u'pgp.mit.edu', u'method': u'keyserver'}) => {"failed": true, "item": {"id": "C43C79AD", "method": "keyserver", "value": "pgp.mit.edu"}, "msg": "unsupported parameter for module: {{ item.method }}"}
please use:
{{ ansible_managed | comment}}
instead
#{{ ansible_managed }}
Each time I try to use this module the first run fails with
Packer Running Ansible Provisioner
amazon-ebs: RUNNING HANDLER [ricbra.logentries : Restart logentries] ***********************
amazon-ebs: fatal: [default]: FAILED! => {"changed": false, "failed": true, "msg": "Pidfile /var/run/logentries.pid already exists. Daemon already running?\n"}
amazon-ebs: to retry, use: --limit @/Users/donovan/code/lendinghome-infrastructure/lendinghome_wordpress/ansible/playbook.retry
or ansible running with an inventory
RUNNING HANDLER [ricbra.logentries : Restart logentries] ***********************
fatal: [35.160.183.61]: FAILED! => {"changed": false, "failed": true, "msg": "Pidfile /var/run/logentries.pid already exists. Daemon already running?\n"}
fatal: [52.24.63.164]: FAILED! => {"changed": false, "failed": true, "msg": "Pidfile /var/run/logentries.pid already exists. Daemon already running?\n"}
fatal: [35.166.202.218]: FAILED! => {"changed": false, "failed": true, "msg": "Pidfile /var/run/logentries.pid already exists. Daemon already running?\n"}
to retry, use: --limit @/Users/donovan/code/lendinghome-infrastructure/lendinghome_wordpress/ansible/playbook.retry
when I checked after the inital failure there was no pid at the pidfile.
I went through the log, and there is no start, or previous restart. It must come from the package.
a subsequent run corrects the problem, unfortunately that doesn't work with packer, its always first run with packer, and it always hits this issue then aborts.
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
ansible 2.2.1.0
packer 0.12.2
E:The repository 'http://rep.logentries.com stretch Release' does not have a Release file
failed: [samxiao.com] => (item={'id': 'C43C79AD', 'value': 'pgp.mit.edu', 'method': 'keyserver'}) => {"cmd": "apt-key adv --keyserver pgp.mit.edu --recv C43C79AD", "failed": true, "item": {"id": "C43C79AD", "method": "keyserver", "value": "pgp.mit.edu"}, "rc": 2}
stderr: gpg: requesting key C43C79AD from hkp server pgp.mit.edu
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
stdout: Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.5iP4mStIpF --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver pgp.mit.edu --recv C43C79AD
?: pgp.mit.edu: Connection timed out
gpgkeys: HTTP fetch error 7: couldn't connect: Connection timed out
msg: gpg: requesting key C43C79AD from hkp server pgp.mit.edu
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
FATAL: all hosts have already failed -- aborting
Hi,
As far as I can see it looks like this role doesn't support the autoscaling feature of logentries. The LE documentation (https://logentries.com/doc/linux-agent-autoscaling/) mentions that the config would need to set pull-server-side-config=False
and set the destination
parameter for each file/path.
I was wondering whether you had any suggestions for adding support for this? I tried to work on a PR but I think the le agent only supports the destination
parameter via the config file and not the CLI. Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.