debops / debops

DebOps - Your Debian-based data center in a box
https://debops.org/
1.26k stars 350 forks source link

apt_cacher_ng errors out on nginx dependency pre hook lookup plugin #561

Open luken opened 6 years ago

luken commented 6 years ago

Running 8.0 GA release installed by pip into ~/.local on debian stretch 9.6

The offending line: https://github.com/debops/debops/blame/master/ansible/roles/debops.nginx/tasks/main.yml#L21

$ debops service/apt_cacher_ng -l ss.oc -vvv
--snip--
TASK [debops.nginx : DebOps pre_tasks hook] ****************************************************************************************************
task path: /home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/roles/debops.nginx/tasks/main.yml:20
fatal: [ss.oc]: FAILED! => {
    "msg": "lookup plugin (task_src) not found"
}
    to retry, use: --limit @/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/playbooks/service/apt_cacher_ng.retry

Verified the nginx/pre_main.yml file exists, it is empty, but so is the version checked in here. Also, note that the users role has the same sort of plugin lookup code but it has been working just fine. Not sure how to debug further. Happy to have debugging tips, I don't know enough to efficiently get into the guts of what is happening in ansible / debops and would love some tips.

luken commented 6 years ago

As a work around, commented out the 3 lines that make up the pre-hook section. Thinks ran along nicely till it hit the post hook section, tripped over the same error message.

TASK [debops.nginx : DebOps post_tasks hook] ***************************************************************************************************
task path: /home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/roles/debops.nginx/tasks/main.yml:280
fatal: [ss.oc]: FAILED! => {
    "msg": "lookup plugin (task_src) not found"
}

as the nginx/post_main.yml file is also empty, commented out the 3 lines in main.yml related to the post hook and things seem to be running.

luken commented 6 years ago

hrm. same error when trying to run apt_install on a diffferent host

$ debops service/apt_install -l unifi.oc -vvv

--snip--

TASK [debops.apt_install : Pre hooks] **********************************************************************************************************
task path: /home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/roles/debops.apt_install/tasks/main.yml:3
fatal: [unifi.oc]: FAILED! => {
    "msg": "lookup plugin (task_src) not found"
}
luken commented 6 years ago

Trying a full run against the host that had the apt_install fail above, this completed successfully

$ debops -l unifi.oc -vvv

--snip--

PLAY RECAP *************************************************************************************************************************************
unifi.oc                   : ok=248  changed=0    unreachable=0    failed=0   
drybjed commented 6 years ago

Can you show the contents of the ansible.cfg generated by the debops script?

Alternatively, in the DebOps master branch, lookup plugins have been moved to the debops.ansible_plugins role which should be included by the roles that need them. You can switch to this branch by running debops-update - it contains a bunch of other changes as well, check the Changelog.

luken commented 6 years ago

Here is the ansible.cfg

# Ansible configuration file generated by DebOps, all changes will be lost.
# You can manipulate the contents of this file via `.debops.cfg`.

[ssh_connection]
pipelining = True
ssh_args = -o ControlMaster=auto -o ControlPersist=60s -o ForwardAgent=yes

[paramiko]

[defaults]
filter_plugins = /home/vagrant/omner/ansible/playbooks/filter_plugins:/home/vagrant/omner/ansible/plugins/filter_plugins:/home/vagrant/omner/ansible/filter_plugins:/home/vagrant/omner/debops/ansible/playbooks/playbooks/filter_plugins:/home/vagrant/omner/debops/ansible/playbooks/filter_plugins:/home/vagrant/omner/debops/ansible/plugins/filter_plugins:/home/vagrant/omner/debops/ansible/filter_plugins:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/filter_plugins:/home/vagrant/omner/ansible/playbooks/filter_plugins:/usr/share/ansible/filter_plugins
connection_plugins = /home/vagrant/omner/ansible/playbooks/connection_plugins:/home/vagrant/omner/ansible/plugins/connection_plugins:/home/vagrant/omner/ansible/connection_plugins:/home/vagrant/omner/debops/ansible/playbooks/playbooks/connection_plugins:/home/vagrant/omner/debops/ansible/playbooks/connection_plugins:/home/vagrant/omner/debops/ansible/plugins/connection_plugins:/home/vagrant/omner/debops/ansible/connection_plugins:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/connection_plugins:/home/vagrant/omner/ansible/playbooks/connection_plugins:/usr/share/ansible/connection_plugins
roles_path = /home/vagrant/omner/roles:/home/vagrant/omner/ansible/roles:/home/vagrant/omner/debops/ansible/roles:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/roles:/home/vagrant/omner/ansible/playbooks/../roles:/home/vagrant/omner/ansible/playbooks/roles:/etc/ansible/roles
log_path = debops.log
display_skipped_hosts = True
retry_files_enabled = True
library = /home/vagrant/omner/ansible/playbooks/library:/home/vagrant/omner/ansible/plugins/library:/home/vagrant/omner/ansible/library:/home/vagrant/omner/debops/ansible/playbooks/playbooks/library:/home/vagrant/omner/debops/ansible/playbooks/library:/home/vagrant/omner/debops/ansible/plugins/library:/home/vagrant/omner/debops/ansible/library:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/library:/home/vagrant/omner/ansible/playbooks/library:/usr/share/ansible/library
vars_plugins = /home/vagrant/omner/ansible/playbooks/vars_plugins:/home/vagrant/omner/ansible/plugins/vars_plugins:/home/vagrant/omner/ansible/vars_plugins:/home/vagrant/omner/debops/ansible/playbooks/playbooks/vars_plugins:/home/vagrant/omner/debops/ansible/playbooks/vars_plugins:/home/vagrant/omner/debops/ansible/plugins/vars_plugins:/home/vagrant/omner/debops/ansible/vars_plugins:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/vars_plugins:/home/vagrant/omner/ansible/playbooks/vars_plugins:/usr/share/ansible/vars_plugins
ansible_managed = This file is managed remotely, all changes will be lost
inventory = /home/vagrant/omner/ansible/inventory
action_plugins = /home/vagrant/omner/ansible/playbooks/action_plugins:/home/vagrant/omner/ansible/plugins/action_plugins:/home/vagrant/omner/ansible/action_plugins:/home/vagrant/omner/debops/ansible/playbooks/playbooks/action_plugins:/home/vagrant/omner/debops/ansible/playbooks/action_plugins:/home/vagrant/omner/debops/ansible/plugins/action_plugins:/home/vagrant/omner/debops/ansible/action_plugins:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/action_plugins:/home/vagrant/omner/ansible/playbooks/action_plugins:/usr/share/ansible/action_plugins
callback_plugins = /home/vagrant/omner/ansible/playbooks/callback_plugins:/home/vagrant/omner/ansible/plugins/callback_plugins:/home/vagrant/omner/ansible/callback_plugins:/home/vagrant/omner/debops/ansible/playbooks/playbooks/callback_plugins:/home/vagrant/omner/debops/ansible/playbooks/callback_plugins:/home/vagrant/omner/debops/ansible/plugins/callback_plugins:/home/vagrant/omner/debops/ansible/callback_plugins:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/callback_plugins:/home/vagrant/omner/ansible/playbooks/callback_plugins:/usr/share/ansible/callback_plugins
lookup_plugins = /home/vagrant/omner/ansible/playbooks/lookup_plugins:/home/vagrant/omner/ansible/plugins/lookup_plugins:/home/vagrant/omner/ansible/lookup_plugins:/home/vagrant/omner/debops/ansible/playbooks/playbooks/lookup_plugins:/home/vagrant/omner/debops/ansible/playbooks/lookup_plugins:/home/vagrant/omner/debops/ansible/plugins/lookup_plugins:/home/vagrant/omner/debops/ansible/lookup_plugins:/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/lookup_plugins:/home/vagrant/omner/ansible/playbooks/lookup_plugins:/usr/share/ansible/lookup_plugins
luken commented 6 years ago

This seems like it might be a problem, its the only reference to lookup_plugins in the pip install directory.

vagrant@stretch:~/omner$ ls /home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/lookup_plugins
ls: cannot access '/home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/lookup_plugins': No such file or directory
luken commented 6 years ago

Pushed

$ debops service/apt_install -l unifi.oc -vvv

back up the hill. it still errors even after the full run succeded (though not surpprising when the full run didn't make any mods on the host).

Added this to .debops/config

[ansible defaults]
lookup_plugins = /home/vagrant/.local/lib/python2.7/site-packages/debops/ansible/playbooks/lookup_plugins

and now the direct apt_install run is working

PLAY RECAP *************************************************************************************************************************************
unifi.oc                   : ok=6    changed=0    unreachable=0    failed=0   

Other than experience knowing this sort of error is a search path related error, is there some way I can get ansible to dump some useful debug information about where it tried to find what it was looking for?

drybjed commented 6 years ago

Not that I know of. You are running the DebOps Vagrantfile, right? What platform are you using with Vagrant?

luken commented 6 years ago

I had my own vagrant thing started before finding the debops vagrantfile, so it's not the standard vagrant config, no. host system is MacOS and the vagrant is: Debian GNU/Linux 9.6 (stretch)

drybjed commented 6 years ago

@luken OK, can you check if vagrant up ; vagrant ssh in the DebOps monorepo sets up the host correctly and you can work in it?