ansible / ansible-modules-core

Ansible modules - these modules ship with ansible
1.3k stars 1.95k forks source link

service module: ubuntu xenial on travis: failure 1 running systemctl show for 'apache2': Failed to connect to bus: No such file or directory #4348

Closed juju4 closed 7 years ago

juju4 commented 8 years ago
ISSUE TYPE

service module

ANSIBLE VERSION
ansible 2.1.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
CONFIGURATION

No extra

OS / ENVIRONMENT

Docker in Travis, mapping ubuntu xenial in local connection

SUMMARY

when using service task to check one is started, task is failed with above message

STEPS TO REPRODUCE

See https://travis-ci.org/juju4/ansible-icinga2/jobs/150094107 https://travis-ci.org/juju4/ansible-bro-ids/jobs/150093516 https://travis-ci.org/juju4/ansible-mhn/jobs/150159300 (only on target xenial, working on trusty)

On a local Vagrantfile with xenial (as found in github/#role#/test/vagrant): it's working normally... So there is something with travis environment

EXPECTED RESULTS

test/vagrant local execution on xenial

TASK [bro-ids : check that mysql is running] ***********************************
task path: /home/julien/Documents/script/homelab/roles/bro-ids/tasks/main.yml:80
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/julien/Documents/script/homelab/roles/bro-ids/test/vagrant/.vagrant/machines/broids/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/julien/.ansible/cp/ansible-ssh-%h-%p-%r 127.0.0.1 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470432978.69-241202336337936 `" && echo ansible-tmp-1470432978.69-241202336337936="` echo $HOME/.ansible/tmp/ansible-tmp-1470432978.69-241202336337936 `" ) && sleep 0'"'"''
<127.0.0.1> PUT /tmp/tmp2IUx42 TO /home/vagrant/.ansible/tmp/ansible-tmp-1470432978.69-241202336337936/service
<127.0.0.1> SSH: EXEC sftp -b - -C -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/julien/Documents/script/homelab/roles/bro-ids/test/vagrant/.vagrant/machines/broids/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/julien/.ansible/cp/ansible-ssh-%h-%p-%r '[127.0.0.1]'
<127.0.0.1> ESTABLISH SSH CONNECTION FOR USER: vagrant
<127.0.0.1> SSH: EXEC ssh -C -vvv -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=2202 -o 'IdentityFile="/home/julien/Documents/script/homelab/roles/bro-ids/test/vagrant/.vagrant/machines/broids/virtualbox/private_key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=vagrant -o ConnectTimeout=30 -o ControlPath=/home/julien/.ansible/cp/ansible-ssh-%h-%p-%r -tt 127.0.0.1 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-drceqxkhrlhnomixtamaaklasdzascol; LANG=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8 /usr/bin/python /home/vagrant/.ansible/tmp/ansible-tmp-1470432978.69-241202336337936/service; rm -rf "/home/vagrant/.ansible/tmp/ansible-tmp-1470432978.69-241202336337936/" > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"''
ok: [broids] => {"changed": false, "invocation": {"module_args": {"arguments": "", "enabled": null, "name": "mysql", "pattern": null, "runlevel": "default", "sleep": null, "state": "started"}, "module_name": "service"}, "name": "mysql", "state": "started"}
ACTUAL RESULTS

https://travis-ci.org/juju4/ansible-bro-ids/jobs/150166292

TASK [bro-ids : check that mysql is running] ***********************************

task path: /etc/ansible/roles/bro-ids/tasks/main.yml:80

<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root

<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1470433523.11-95534498356016 `" && echo ansible-tmp-1470433523.11-95534498356016="` echo $HOME/.ansible/tmp/ansible-tmp-1470433523.11-95534498356016 `" ) && sleep 0'

<localhost> PUT /tmp/tmpMC1xcR TO /root/.ansible/tmp/ansible-tmp-1470433523.11-95534498356016/service

<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1470433523.11-95534498356016/service; rm -rf "/root/.ansible/tmp/ansible-tmp-1470433523.11-95534498356016/" > /dev/null 2>&1 && sleep 0'

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"arguments": "", "enabled": null, "name": "mysql", "pattern": null, "runlevel": "default", "sleep": null, "state": "started"}, "module_name": "service"}, "msg": "failure 1 running systemctl show for 'mysql': Failed to connect to bus: No such file or directory\n"}
ansibot commented 8 years ago

@grossws ping, this issue is waiting for your response. click here for bot help

juju4 commented 8 years ago

might be related to https://github.com/ansible/ansible-modules-core/issues/161 https://github.com/influxdata/telegraf/issues/1022

ansibot commented 8 years ago

@grossws, ping. This issue is still waiting on your response. click here for bot help

geerlingguy commented 7 years ago

I seem to have hit this as well, in a Fedora 24 Docker build on Travis CI (note that I can't reproduce the issue using the exact same container and build steps when running them on Docker for Mac 1.12.1...). See: https://travis-ci.org/geerlingguy/ansible-role-redis/jobs/160756445#L298

ansibot commented 7 years ago

@ansible, ping. This issue is waiting on your response. click here for bot help

ansibot commented 7 years ago

@ansible, ping. This issue is still waiting on your response. click here for bot help

juju4 commented 7 years ago

for reference, running privileged works, but not --cap-add=SYS_ADMIN

    run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"

as seen here https://github.com/docker/docker/issues/7459 seems for cap-add need an unreleased docker.

ansibot commented 7 years ago

@ansible, ping. This issue is still waiting on your response. click here for bot help

ansibot commented 7 years ago

@ansible, ping. This issue is still waiting on your response. click here for bot help

ansibot commented 7 years ago

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide. The guide contains links to tools which automatically move your issue or pull request to the ansible/ansible repo.

juju4 commented 7 years ago

This issue was moved to ansible/ansible#19818