# Deploying and enrolling an agent using ansible. (Ansible-lint failure)

**URL:** <https://discuss.elastic.co/t/deploying-and-enrolling-an-agent-using-ansible-ansible-lint-failure/375897>\
**Category:** Elastic Agent\
**Created:** [March 14, 2025, 7:40am UTC](https://discuss.elastic.co/t/deploying-and-enrolling-an-agent-using-ansible-ansible-lint-failure/375897 "2025-03-14T07:40:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joey\_Visbeen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joey_visbeen/32/134690_2.png) [@Joey\_Visbeen](https://discuss.elastic.co/u/Joey_Visbeen)\
**Post date:** [March 14, 2025, 7:40am UTC](https://discuss.elastic.co/t/deploying-and-enrolling-an-agent-using-ansible-ansible-lint-failure/375897/1 "2025-03-14T07:40:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 14, 2025, 11:33am UTC](https://discuss.elastic.co/t/deploying-and-enrolling-an-agent-using-ansible-ansible-lint-failure/375897/2 "2025-03-14T11:33:13Z")

</div>

> [@Joey\_Visbeen](#):
>
> 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.

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:

```auto
# elastic-agent status --output json | jq .FleetMessage
"Connected"

```

The documentation for the cli can be found [here](https://www.elastic.co/guide/en/fleet/current/elastic-agent-cmd-options.html#elastic-agent-status-command).

> [@Joey\_Visbeen](#):
>
> Chadgpt said to check for .fleet-enrolled files, but I don't see them when I enroll the agent.

Probably ChatGPT inventend this as it already has invented a lot of things about other tools, always validate with the documentation.
