New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable set to 0755 in a list gets interpreted as 493 (mode must be in octal or symbolic form) #31952
Comments
The problem is that you define as an octal first, which is good, however pyyaml converts that to an int, which is ok too. But later when you use You should start off just quoting the mode to make it |
@sivel I discovered by trial and error that quoting the value fixes the problem. What I don't understand is that if I set a variable called #Set permissions on mount points
- name: Ensure mount point has desired permissions
file:
path: "{{ item.mount }}"
owner: "{{ item.mount_owner }}"
group: "{{ item.mount_group }}"
mode: "{{ mode }}"
with_items: "{{ lvm_lvs }}" |
It's indeed a complicated issue, and one we are actively working on trying to solve (pallets/jinja#708) The short of the problem, is that jinja (the templating language/module we use) only has the ability to return strings. We can sometimes get around that and make inferences, but not always. When that variable is part of the list/array that you are looping over in If you have further questions please stop by IRC or the mailing list:
|
There seems to be a defect/problem in ansible which prevents it from using the mode option in the file module. A quick search on "mode must be in octal or symbolic form" turn up examples like: ansible/ansible#31952 The "mode" option is not required at thispoint in the installation (nova deployment), because the directory already has the correct mode from os-config section of the installation. Thus setting the hugepage directories file permissions can be bypassed. Change-Id: Ie19c5b655ad61ccbfba28ff8f0ad7c462e6b573b
ISSUE TYPE
COMPONENT NAME
ansible-playbook
ANSIBLE VERSION
CONFIGURATION
host_key_checking = False
OS / ENVIRONMENT
Ansible control server: Red Hat Enterprise Linux Server release 7.4 (Maipo)
Node: Red Hat Enterprise Linux Server release 7.4 (Maipo)
SUMMARY
I have a variable that is a list. Within that list I have a a value called mount_mode set to 0755. When iterating through the list in a loop (with_items) the 0755 value gets interpreted as 493. The only work-around I found is to wrap the 0755 with single-quotes. If I place a variable outside of the list called mode with value 0755 and refer to it in the loop, the 0755 gets interpreted properly without single-quotes.
STEPS TO REPRODUCE
EXPECTED RESULTS
{{ item.mount_mode }} should be interpreted as 0755, but instead it gets interpreted as 493.
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: