Bug #31753
closedcan't execute ansible on Debian
Description
(filing this against foreman_ansible, but in reality there will be more than one component involved)
Currently, when you install Foreman with --enable-foreman-plugin-ansible --enable-foreman-proxy-plugin-ansible
this does not result in a working Foreman Ansible setup.
When trying to run an Ansible job, the first thing you'll encounter is uninitialized constant ForemanAnsibleCore
(see https://community.theforeman.org/t/cant-get-foreman-ansible-to-work/21751).
That is, at large, because we don't install foreman-ansible-core by default right now.
Installing it by hand yields:
dpkg: error processing archive /tmp/apt-dpkg-install-ARihr2/5-ruby-foreman-ansible-core_4.0.0-buster+scratchbuild20210118132237_all.deb (--unpack): trying to overwrite '/usr/bin/json_inventory.sh', which is also in package ruby-smart-proxy-ansible 3.0.0-2 Errors were encountered while processing: /tmp/apt-dpkg-install-ARihr2/5-ruby-foreman-ansible-core_4.0.0-buster+scratchbuild20210118132237_all.deb
I am not exactly sure who should own that file, but not both (funnily, core/runner/command_creator.rb does genetate the path as /usr/lib/ruby/bin/json_inventory.sh
, so it wouldn't find it anyways).
After forcing dpkg to overwrite that file (for testing only, of course), the gem was still not loaded until Adam hasn't fixed the deployment in https://github.com/theforeman/foreman-packaging/pull/6165 (merged just now into nightly).
Having that fixed, I was able to schedule an Ansible job in Foreman, but it failed with ERROR! Unexpected Exception, this is probably a bug: No module named 'psutil'
. I think that's because Debian ships Ansible with Python3 already, while Ansible Runner doesn't know that and only depends on python-psutil. Installing python3-psutil fixes this.
However, the next run would still fail for me: fatal: [debian10-foreman-nightly.yatsu.example.com]: FAILED! => {"msg": "Unable to create local directories(/usr/share/foreman-proxy/.ansible/cp): [Errno 13] Permission denied: b'/usr/share/foreman-proxy/.ansible'"}
-- I think it's not honouring our ansible.cfg correctly, which tells it to use /tmp for this, but didn't dive further yet.
and fixing that, you'll see:
fatal: [debian10-foreman-nightly.yatsu.example.com]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Could not create directory '/usr/share/foreman-proxy/.ssh'.\r\nFailed to add the host to the list of known hosts (/usr/share/foreman-proxy/.ssh/known_hosts).\r\nno such identity: /usr/share/foreman-proxy/.ssh/id_rsa_foreman_proxy: No such file or directory\r\nroot@debian10-foreman-nightly.yatsu.example.com: Permission denied (publickey).", "unreachable": true}
Updated by Ewoud Kohl van Wijngaarden almost 4 years ago
- Related to Bug #24879: ruby-foreman-ansible-core '/usr/lib/ruby/vendor_ruby/foreman_ansible_core.rb' conflicts with ruby-smart-proxy-ansible added
Updated by Evgeni Golov almost 4 years ago
tha last error is due to it trying to place the "controlpersist" files into the cp folder
on RPM based we have
# ls -alhd /usr/share/foreman-proxy/.ansible
lrwxrwxrwx. 1 root root 30 Nov 23 2019 /usr/share/foreman-proxy/.ansible -> /var/lib/foreman-proxy/ansible
on deb we dont…
Updated by Evgeni Golov almost 4 years ago
- Pull request https://github.com/theforeman/foreman-packaging/pull/6165, https://github.com/theforeman/foreman-packaging/pull/6235 added
Updated by Evgeni Golov almost 4 years ago
- Pull request https://github.com/theforeman/smart_proxy_ansible/pull/27 added
Updated by Evgeni Golov almost 4 years ago
- Description updated (diff)
- Pull request https://github.com/theforeman/foreman-packaging/pull/6297 added
Updated by Evgeni Golov almost 4 years ago
- install
python3-psutil
manually - install Foreman with ansible using
foreman-installer --enable-foreman-plugin-ansible --enable-foreman-proxy-plugin-ansible --enable-foreman-proxy-plugin-remote-execution-ssh
, REX-SSH is needed for the setup of the ssh key etc.
Updated by Evgeni Golov almost 4 years ago
- Pull request https://github.com/theforeman/foreman-packaging/pull/6304 added
Updated by Evgeni Golov almost 4 years ago
- Status changed from New to Resolved
- Assignee set to Evgeni Golov
This has been fixed in ruby-foreman-ansible-core_4.0.0-2 and ruby-smart-proxy-ansible_3.0.0-4 which have been pushed out to Foreman 2.2, 2.3, 2.4 and nightly repositories.