Open jeff-cook opened 5 years ago
I have a work around. Just run it twice and ignore errors for the first run. I don't like it, but it did get my YAML file with the correct values, so I could keep testing.
- name: "manage {{username}}.hash in internal_users.yml file"
yedit:
src: "{{od4es_internal_users_file}}"
key: "{{username}}.hash"
value: "{{ userhash }}"
ignore_errors: true
tags:
- stack
- name: "manage {{username}}.hash in internal_users.yml file"
yedit:
src: "{{od4es_internal_users_file}}"
key: "{{username}}.hash"
value: "{{ userhash }}"
I'm also seeing this error on RHEL8 using: ansible + python 3.6 or 3.9:
ansible-playbook [core 2.11.4]
config file = /vagrant/openshift4-ansible-installer/ansible.cfg
configured module search path = ['/home/vagrant/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/vagrant/.local/lib/python3.9/site-packages/ansible
ansible collection location = /home/vagrant/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.2 (default, Mar 5 2021, 01:49:45) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
jinja version = 3.0.1
libyaml = True
I don't have the error on OSX using: ansible + python 3.9:
ansible-playbook [core 2.11.2]
config file = /Users/xx/gitrepo/private/puppet-monorepo/openshift4-ansible-installer/ansible.cfg
configured module search path = ['/Users/xx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /Users/xx/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-playbook
python version = 3.9.5 (default, May 4 2021, 03:36:27) [Clang 12.0.0 (clang-1200.0.32.29)]
jinja version = 3.0.1
libyaml = True
The correlation between @jeff-cook s issue and mine is that we both use vagrant and probably are both using the /vagrant folder to run the playbook.
Vagrant uses a vboxfs
filesystem mount of a local os filesystem into the vagrant box. I assume that it doesn't support os.fsync like other network based filesystems.
vagrant on /vagrant type vboxsf (rw,nodev,relatime,iocharset=utf8,uid=65535,gid=65535)
Ref: https://github.com/kwoodson/ansible-role-yedit/blob/master/library/yedit.py#L417-L434
The code runs fine within vagrant on a regular xfs/ext/.. filesystem.
When running the following code it reports as failed. The value is correctly updated.
When the 'hash' already has the matching value it reports "OK" or unchanged.
The file being updated is https://github.com/opendistro-for-elasticsearch/security/blob/master/securityconfig/internal_users.yml