For the installation of the agent on a Linux server I use RPM. This involves using yum. After which the downloaded agent needs to be enrolled. The command in Ansible in straight forward, but Ansible-lint blocks it because there is no check if the command has already been executed. I agree with Ansible that there needs to be a check whether the agent is already enrolled, but I can not seem to find any change in file structure or command that shows that the agent is enrolled.
Any solutions for this check?
PS: Chadgpt said to check for .fleet-enrolled files, but I don't see them when I enroll the agent.
Have you checked if running elastic-agent status can help? I don't think there is any file that will tell you if the agent is already enrolled or not, but with elastic-agent status you can see the status of the agent.
For example, running something like this would tell you if the agent is connected to the fleet server:
# elastic-agent status --output json | jq .FleetMessage
"Connected"
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.