pimp-my-box icon indicating copy to clipboard operation
pimp-my-box copied to clipboard

Error running ansible-playbook

Open tbennett6421 opened this issue 3 years ago • 4 comments

Following the steps on https://pimp-my-box.readthedocs.io/en/latest/setup.html

When running ansible-playbook I get the following error.

❯ ansible-playbook -i hosts site.yml
ERROR! 'include' is not a valid attribute for a Play

The error appears to be in '/Users/user/pimp-my-box/site.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

# All available playbooks
- include: common.yml
  ^ here

tbennett6421 avatar Oct 04 '22 17:10 tbennett6421

"include" has been deprecated. https://docs.ansible.com/ansible/latest/collections/ansible/builtin/include_module.html#deprecated

It's been split into different modules. I tried doing a find/replace to change all include to import-playbook but import-playbook isn't the correct one for every instance of include in all the .yml files so no there's quick hack to fix this.

So the last commit was well over a year ago. I'll try and fix this, if I can I'll fork and post here again.

clidx avatar Oct 06 '22 20:10 clidx

Well that was easy... I think, because I've run into a sudo issue trying to execute the playbook so can't really test it yet, but ansible doesn't complain about include anymore. Give it a go and let me know if it works so I can raise a PR. https://github.com/clidx/pimp-my-box

clidx avatar Oct 06 '22 21:10 clidx

recommend you add become: True to the deadsnakes ppa as well. pimp-my-box/roles/common/tasks/main.yml:4

I continued to run into issues installing. But I'm using ubuntu 22 which may be why. That being said, your solution did get ansible to begin running the play.

tbennett6421 avatar Oct 07 '22 02:10 tbennett6421

It's not up-to-date for newer versions of Ubuntu and Debian. I had to add Become: True to a lot of commands as a lot of them install packages or change things for the rtorrent user, and pyrocore still wouldn't install because it's based on python 2 and many of the packages only exist for python 3 now. Even after changing the required packages and setting ansible to use the system python interpreter, pyrocore still doesn't install.

I've given up on pyrocore, luckily I don't need the extra tools for my workflow, however I couldn't even get rtorrent-PS to compile with the provided script. rtorrent-PS-ch compiles fine though so I'm using that.

clidx avatar Oct 07 '22 08:10 clidx