0

Using Ubuntu 19.04 and Python 3.7

When I create a directory with Ansible, file ownership is changed in /usr/lib/python3.7

Obviously this should not happen and it breaks Python for the whole of Ubuntu, until the permissions are corrected.

The problem only happens when recurse=yes is used.

Here is a video showing the problem: https://youtu.be/d3hj255pW9w

Here is the code/Ansible playbook:

ubuntu@ubuntu-GB-BXi3-5010:~/ansible$ cat ~/ansible/renderworker/ffmpegconverter/ansible/test.yml
---
- hosts: renderworkerhosts
  become: yes

  tasks:

    # for some reason, recurse=yes results in owner & permissions changing in /usr/lib/python3.7
    # which breaks Python on Ubuntu

    - name: Create directory
      file:
        path=/opt/ffmpegconverter
        state=directory
        owner=root
        group=ffmpeguser
        mode=u=rwx,g=rwx,o=
        recurse=yes

ubuntu@ubuntu-GB-BXi3-5010:~/ansible$
Duke Dougal
  • 24,359
  • 31
  • 91
  • 123

1 Answers1

0

You should use a colon instead of the equal sign for delimiter between keys and values:

path: /etc/foo.conf
Oliver Gaida
  • 1,722
  • 7
  • 14
  • Could you explain more please. Are you saying this is the problem? Is it a requirement or a preference to use colon? Most of my ansible scripts seems to work using equal sign - are they wrong? thanks!! – Duke Dougal Jun 20 '19 at 04:58
  • please have a look at https://stackoverflow.com/questions/42907723/yaml-when-an-equals-sign-can-be-used-for-dictionaries . In short for complex parameters it is unreliable to use equal signs. – Oliver Gaida Jun 20 '19 at 06:01
  • and i don't know if it is the problem – Oliver Gaida Jun 20 '19 at 06:02
  • Not happening to me with ubuntu 18.04 and debian 9 hosts (run from Fedora 30 and Ansible 2.8.1), just to make sure try to change the delimiters to `:` as suggested, another option is to debug the produced python code by `export ANSIBLE_KEEP_REMOTE_FILES=1` – Rabin Jun 20 '19 at 10:28