# Playbook not running

**URL:** <https://forum.ansible.com/t/playbook-not-running/8131>\
**Category:** Get Help\
**Tags:** playbook, aws, collections\
**Created:** [August 28, 2024, 10:22am UTC](https://forum.ansible.com/t/playbook-not-running/8131 "2024-08-28T10:22:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake.Cuz](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@Jake.Cuz](https://forum.ansible.com/u/Jake.Cuz)\
**Post date:** [August 28, 2024, 10:22am UTC](https://forum.ansible.com/t/playbook-not-running/8131/1 "2024-08-28T10:22:07Z")

</div>

Hi All,

Getting this error when attempting to run a playbook :

ERROR! couldn’t resolve module/action ‘lineinefile’. This often indicates a misspelling, missing collection, or incorrect module path.

The error appears to be in ‘/root/ansible-aws-playbooks/nonprod\_inventory-playbook.yml’: line 20, column 7, but may  
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

```
- name: Create inventory file for nonprod group
  ^ here

```

Playbook section with error :

```
- name: Create inventory file for nonprod group
  lineinefile:
    path: ./inventory.ini
    create: yes
    line: "{{ instance.public_dns_name }} ansible_host={{ instance.public_ip_address }}"
  loop: "{{ec2_info.instances }}"
  when: ec2_info.instance | length > 0

```

This is using the AWS modules & Ansible community.

Syntax checker suggests the YAML format is correct.

Any ideas?

---

<div class="post-metadata">

**Author:** ![markuman](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@markuman](https://forum.ansible.com/u/markuman)\
**Post date:** [August 28, 2024, 11:12am UTC](https://forum.ansible.com/t/playbook-not-running/8131/2 "2024-08-28T11:12:43Z")

</div>

Have you tried the full qualified module name? `ansible.builtin.lineinfile:`.

Furthermore, before start managing a static inventory based on created EC2 instances, have you tried the EC2 dynamic inventory?

[https://docs.ansible.com/ansible/latest/collections/amazon/aws/docsite/aws\_ec2\_guide.html](https://docs.ansible.com/ansible/latest/collections/amazon/aws/docsite/aws_ec2_guide.html)

---

<div class="post-metadata">

**Author:** ![Jake.Cuz](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@Jake.Cuz](https://forum.ansible.com/u/Jake.Cuz)\
**Post date:** [August 28, 2024, 11:40am UTC](https://forum.ansible.com/t/playbook-not-running/8131/3 "2024-08-28T11:40:16Z")

</div>

Hi Markus,

I’ve tried the FQMN, should have put that in the post.

I’ve not tried Ec2 dynamic inventory but this does seem like it would be a better idea.

I’ll take a look at that.

In the meantime any other ideas?

---

<div class="post-metadata">

**Author:** ![akira6592](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akira6592/32/222_2.png) [@akira6592](https://forum.ansible.com/u/akira6592)\
**Post date:** [August 28, 2024, 12:41pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/4 "2024-08-28T12:41:11Z")

</div>

Hello @Jake.Cuz

Did you change the [`DEFAULT_MODULE_PATH`](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#default-module-path) setting?

Could you show us `ansible-config dump --only-changed` result?

---

<div class="post-metadata">

**Author:** ![Jake.Cuz](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@Jake.Cuz](https://forum.ansible.com/u/Jake.Cuz)\
**Post date:** [August 28, 2024, 12:54pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/5 "2024-08-28T12:54:51Z")

</div>

Hi Akira,

CONFIG\_FILE() = /root/ansible-aws-playbooks/ansible.cfg  
DEFAULT\_HOST\_LIST(/root/ansible-aws-playbooks/ansible.cfg) = [‘/root/ansible-aws-playbooks/inventory’]  
HOST\_KEY\_CHECKING(/root/ansible-aws-playbooks/ansible.cfg) = False

I’ve not changed the default\_module\_path setting.

This however has highlighted I need to move that file as I’ve left it in the wrong place.

Is common practice to put it in /etc/ansible ?

---

<div class="post-metadata">

**Author:** ![akira6592](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akira6592/32/222_2.png) [@akira6592](https://forum.ansible.com/u/akira6592)\
**Post date:** [August 28, 2024, 1:09pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/6 "2024-08-28T13:09:09Z")

</div>

Thank you for the information.

If `DEFAULT_MODULE_PATH` is still the default, I don’t know what the cause is…

I usually put `ansible.cfg` on project top.

---

<div class="post-metadata">

**Author:** ![Incrediblestorm](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/incrediblestorm/32/3561_2.png) [@Incrediblestorm](https://forum.ansible.com/u/Incrediblestorm)\
**Post date:** [August 28, 2024, 1:13pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/7 "2024-08-28T13:13:32Z")

</div>

lineinefile  
lineinfile

If no one else has mentioned it. It’s a typo.

---

<div class="post-metadata">

**Author:** ![Jake.Cuz](https://avatars.discourse-cdn.com/v4/letter/j/8dc957/32.png) [@Jake.Cuz](https://forum.ansible.com/u/Jake.Cuz)\
**Post date:** [August 28, 2024, 1:40pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/8 "2024-08-28T13:40:21Z")

</div>

This was obviously it 🤣

---

<div class="post-metadata">

**Author:** ![Incrediblestorm](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/incrediblestorm/32/3561_2.png) [@Incrediblestorm](https://forum.ansible.com/u/Incrediblestorm)\
**Post date:** [August 28, 2024, 3:03pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/9 "2024-08-28T15:03:19Z")

</div>

I have to hand it to you though, that is probably one of the toughest to spot, psychologically, that I’ve seen.

Your head thinks it’s fine because of the “ine” in line, or at least mine does.

---

<div class="post-metadata">

**Author:** ![techiechap](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/techiechap/32/3247_2.png) [@techiechap](https://forum.ansible.com/u/techiechap)\
**Post date:** [August 28, 2024, 3:41pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/10 "2024-08-28T15:41:25Z")

</div>

lineinfile can you check the spelling

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 27, 2024, 3:42pm UTC](https://forum.ansible.com/t/playbook-not-running/8131/11 "2024-09-27T15:42:05Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
