0

I'm trying install something called Internet-Pi on my Raspberry Pi. I've followed the instructions and I believe everything got installed correctly. I and am on the last step where I'm supposed to run ansible-playbook.

I get the error:

pi@raspberrypi:~/internet-pi $ ansible-playbook main.yml
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in '/home/pi/internet-pi/main.yml': line 26, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  handlers:
    - name: Include handlers.
      ^ here

I don't know where to start trouble shooting this. The yml file is:

---
- hosts: internet_pi
  become: true

  pre_tasks:
    - name: Load configuration (with defaults from example file).
      ansible.builtin.include_vars: "{{ item }}"
      loop:
        - example.config.yml
        - config.yml

    - name: Ensure apt cache is up to date.
      ansible.builtin.apt:
        update_cache: true
        cache_valid_time: 3600
      when:
        - ansible_facts.os_family == "Debian"

    - name: Ensure pacman cache is up to date
      community.general.pacman:
        update_cache: true
      when:
        - ansible_facts.os_family == "Archlinux"

  handlers:
    - name: Include handlers.
      ansible.builtin.import_tasks: tasks/handlers.yml

  tasks:
    - name: Setup Docker.
      ansible.builtin.import_tasks: tasks/docker.yml

    - name: Set up Internet Monitoring.
      ansible.builtin.import_tasks: tasks/internet-monitoring.yml
      when: monitoring_enable

    - name: Set up Pi Hole.
      ansible.builtin.import_tasks: tasks/pi-hole.yml
      when: pihole_enable

    - name: Set up Shelly Plug Monitoring.
      ansible.builtin.import_tasks: tasks/shelly-plug.yml
      when: shelly_plug_enable

    - name: Set up Air Gradient Monitoring.
      ansible.builtin.import_tasks: tasks/airgradient.yml
      when: airgradient_enable

    - name: Set up Starlink Monitoring.
      ansible.builtin.import_tasks: tasks/starlink.yml
      when: starlink_enable

and handlers.yml is

---
- name: Restart pi-hole
  community.docker.docker_compose:
    project_src: ~/pi-hole/
    build: false
    restarted: true
  become: false

- name: Restart internet-monitoring
  community.docker.docker_compose:
    project_src: ~/internet-monitoring/
    build: false
    restarted: true
  become: false

- name: Restart shelly-plug-prometheus
  community.docker.docker_compose:
    project_src: ~/shelly-plug-prometheus/
    build: false
    restarted: true
  become: false

- name: Restart airgradient-prometheus
  community.docker.docker_compose:
    project_src: ~/airgradient-prometheus/
    build: false
    restarted: true
  become: false

- name: Restart starlink-exporter
  community.docker.docker_compose:
    project_src: ~/starlink-exporter/
    build: false
    restarted: true
  become: false

If I try to run ansible.builtin.import_tasks I get 'command not found'.

Where should I start troubleshooting?

2 Answers 2

1

I had the same exact issue setting up internet-pi on a new Raspberry Pi 4, so I decided to do sudo apt purge ansible and sudo apt purge python3-pip and start from scratch. And when doing so it was then I realized I mistakenly ran pip3 install ansible after running sudo apt-get install -y python3-pip the first time, when the python3-pip installation was sufficient. So I think the subsequent explicit install of ansible screwed up the ansible installation in some way. So after purging and then just installing python3-pip, everything works fine.

1

I don't think you want to have a - name when you import the handlers. The names used to trigger the actions would be in the handlers.yml. Try removing the - name under handlers and back up the import statement by 2 spaces in the main.yml.

2
  • I've used this exact .yml file before so I don't think it's that. I'm kind of wondering if it's permissions or something but permissions are: -rwxr-xr-x 1 root root 1178 Jul 27 17:31 main.yml
    – Shawn
    Jul 27, 2021 at 22:34
  • I re-imaged my pi and started over installing dependencies... and everything worked. Don't know why. Thanks for your input though.
    – Shawn
    Jul 29, 2021 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .