Closed roumano closed 6 years ago
I have a similar issue with the systemd module on centos7:
the rpcbind.service task is in state changed every time I run ansible even though rpcbind.socket is disabled:
- name: disable and stop the rpcbind service
systemd:
name: rpcbind.service
state: stopped
enabled: no
- name: disable rpcbind socket
systemd:
name: rpcbind.socket
state: stopped
enabled: no
(I am guessing) This is probably because of the "indirect" state of rpcbind.service:
[root@REDACTED ~]# systemctl status rpcbind.service
● rpcbind.service - RPC bind service
Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled)
Active: inactive (dead)
[root@REDACTED ~]# systemctl status rpcbind.socket
● rpcbind.socket - RPCbind Server Activation Socket
Loaded: loaded (/usr/lib/systemd/system/rpcbind.socket; disabled; vendor preset: enabled)
Active: inactive (dead)
Listen: /var/run/rpcbind.sock (Stream)
[::]:111 (Stream)
0.0.0.0:111 (Stream)
I tried unsuccessful to reproduce the issued describe by roumano using RHEL6/7 as managed hosts and ansible:
$ ./bin/ansible --version
ansible 2.5.0 (devel 3277e6328b) last updated 2017/09/11 20:13:12 (GMT +200)
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/gsciorti/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /home/gsciorti/PycharmProjects/ansible/lib/ansible
executable location = ./bin/ansible
python version = 2.7.13 (default, May 10 2017, 20:04:28) [GCC 6.3.1 20161221 (Red Hat 6.3.1-1)]
@soul9 I have reproduced the problem described in your comment using the ansible version describe about but it maybe unrelated to the issue opened bt roumano, I think that open a separated issue will be a better solution to manage it.
I encounter the same issue when managing a CentOS 6 using Ansible 2.4.1.0 with the service module with "enabled=yes". I encounter this issue when running Ansible from CentOS 7.4.1708 and Fedora 27, but not ArchLinux.
CentOS 7.4.1708:
ansible 2.4.1.0
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Aug 4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
No configuration override
Fedora 27:
ansible 2.4.1.0
config file = /home/user/.ansible/ansible-default.cfg
configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.14 (default, Nov 3 2017, 10:55:25) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)]
ANSIBLE_SSH_CONTROL_PATH(/home/user/.ansible/ansible-default.cfg) = %(directory)s/%%h-%%r
CACHE_PLUGIN(/home/user/.ansible/ansible-default.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/user/.ansible/ansible-default.cfg) = ~/.cache/ansible/
CACHE_PLUGIN_TIMEOUT(/home/user/.ansible/ansible-default.cfg) = 82800
DEFAULT_CALLBACK_PLUGIN_PATH(/home/user/.ansible/ansible-default.cfg) = [u'/home/user/.ansible/hooks/callback', u'/usr/share/ansible_plugins/callback_plugins']
DEFAULT_FORKS(/home/user/.ansible/ansible-default.cfg) = 20
DEFAULT_GATHERING(/home/user/.ansible/ansible-default.cfg) = smart
DEFAULT_HOST_LIST(/home/user/.ansible/ansible-default.cfg) = [u'/home/user/ansible/inventory']
DEFAULT_MANAGED_STR(/home/user/.ansible/ansible-default.cfg) = Ansible managed
DEFAULT_ROLES_PATH(/home/user/.ansible/ansible-default.cfg) = [u'/home/user/ansible/roles']
DEFAULT_SQUASH_ACTIONS(/home/user/.ansible/ansible-default.cfg) = ['apk', 'apt', 'dnf', 'homebrew', 'pacman', 'pkgng', 'yum', 'zypper']
DEFAULT_VAULT_PASSWORD_FILE(/home/user/.ansible/ansible-default.cfg) = /home/user/ansible/scripts/get_vault_password.sh
RETRY_FILES_ENABLED(/home/user/.ansible/ansible-default.cfg) = False
ArchLinux:
ansible 2.4.1.0
config file = /home/user/.ansible.cfg
configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /opt/molecule2/lib/python2.7/site-packages/ansible
executable location = /opt/molecule2/bin/ansible
python version = 2.7.14 (default, Sep 20 2017, 01:25:59) [GCC 7.2.0]
ANSIBLE_PIPELINING(/home/user/.ansible.cfg) = True
ANSIBLE_SSH_CONTROL_PATH(/home/user/.ansible.cfg) = %(directory)s/%%h-%%r
CACHE_PLUGIN(/home/user/.ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/user/.ansible.cfg) = ~/.cache/ansible/
CACHE_PLUGIN_TIMEOUT(/home/user/.ansible.cfg) = 39600
DEFAULT_GATHERING(/home/user/.ansible.cfg) = smart
DEFAULT_HOST_LIST(/home/user/.ansible.cfg) = [u'/home/user/ansible/inventory']
DEFAULT_LOG_PATH(/home/user/.ansible.cfg) = /tmp/ansible.log
DEFAULT_ROLES_PATH(/home/user/.ansible.cfg) = [u'/home/user/ansible/roles']
DEFAULT_SQUASH_ACTIONS(/home/user/.ansible.cfg) = ['apk', 'apt', 'dnf', 'homebrew', 'pacman', 'pkgng', 'yum', 'zypper']
DEFAULT_VAULT_PASSWORD_FILE(/home/user/.ansible.cfg) = /home/user/ansible/scripts/get_vault_password.sh
RETRY_FILES_ENABLED(/home/user/.ansible.cfg) = False
I can't find an explanation for this issue appearing on CentOS and Fedora, but not on ArchLinux.
I can confirm the issue still exists in Ansible 2.6.2
Got a test setup with an amazonlinux docker container running with kitchen-ansible.
Edit: I just noticed that it could also be my init.d script which fails
Just in case you want to reproduce it "idempotently" :laughing: :
docker container exec -it $(docker container run -d -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /tmp --tmpfs /run --tmpfs /run/lock tecnativa/ansible-test-playground:ubuntu-18.04) sh -c 'apt update && apt install python3-pip && pip3 install ansible==2.6.4 && chmod +x /usr/local/bin/ansible* && ansible localhost -m service -a "name=systemd-journald state=stopped enabled=false" -e ansible_connection=local && ansible localhost -m service -a "name=systemd-journald state=stopped enabled=false" -e ansible_connection=local'
:point_up: There you're running a systemd-enabled ubuntu 18.04 container and disabling the systemd-journald
service twice. The 2nd time it is expected to return ok
, but it returns changed
.
Remember to stop the container when you finish.
@Yajo I don't think that's the same issue as this because this issue is originally reported against CentOS6 which doesn't have systemd. However if you're seeing that it might very well be a different problem.
@roumano I'm unable to reproduce this issue, are you still experiencing it?
needs_info
But I'm using the same module, isn't it?
Well, in any case, do you think I'm better opening a new issue?
@Yajo yes please, I think these issues are disjoint but both valid issues. Thank you.
There you have: https://github.com/ansible/ansible/issues/46247
@roumano This issue is waiting for your response. Please respond or the issue will be closed.
With a recent version of ansible, i can't reproduce it anymore ( 2.7.1 ) With the default version in debian stretch , i can still reproduce the issue ( 2.2.1.0 )
Ansible 2.2 is no longer supported. Since this works as expected in a recent version of Ansible, I am going to close this out.
If you have further questions please stop by IRC or the mailing list:
ISSUE TYPE
COMPONENT NAME
module service
ANSIBLE VERSION
ansible in the Fedora 26 repo :
CONFIGURATION
I also have tested with ansible installed from pip and virtualenv :
OS / ENVIRONMENT
SUMMARY
service on RHEL6/Centos6 are not idempotent (tested on virtualbox box name " centos/6 " and on a "real" server Red Hat Enterprise Linux Server release 6.8 (Santiago)
STEPS TO REPRODUCE
runnning it twise to detect the idempotent issue :
ansible-playbook test.yml --inventory list_vagrant --limit centos6,centos7 ansible-playbook test.yml --inventory list_vagrant --limit centos6,centos7
EXPECTED RESULTS
ACTUAL RESULTS
with extra verbosity :