Skip to content

Instantly share code, notes, and snippets.

@mplanchard
Last active February 5, 2017 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mplanchard/e38393c71c732733797a89f08532614b to your computer and use it in GitHub Desktop.
Save mplanchard/e38393c71c732733797a89f08532614b to your computer and use it in GitHub Desktop.
ansible_sysfile
# Permission denied error
- name: ensure transparent huge pages are disabled
copy:
content: never
dest: "{{ celery_thp_file }}"
owner: root
group: root
mode: 0644
notify: restart redis-server service
become: yes
# Permission denied error
- name: test
lineinfile:
dest: "{{ celery_thp_file }}"
regexp: ^\S.*$
line: never
state: present
become: yes
# Doesn't fail, but also doesn't change the file contents
- name: test
shell: echo "never" > {{ celery_thp_file }}
become: yes
# Command output with unsafe_writes: yes
fatal: [qa-invision-celery-broker-1]: FAILED! => {
"changed": false,
"checksum": "85777c03b72554cd08e721b6148dc27d2a50a7a6",
"failed": true,
"invocation": {
"module_args": {
"backup": false,
"content": null,
"delimiter": null,
"dest": "/sys/kernel/mm/transparent_hugepage/enabled",
"directory_mode": null,
"follow": false,
"force": true,
"group": null,
"mode": null,
"original_basename": "tmpS8YmLK",
"owner": null,
"regexp": null,
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": "/home/mplanchard/.ansible/tmp/ansible-tmp-1486256017.53-188520396216549/source",
"unsafe_writes": true,
"validate": null
}
},
"msg": "The destination directory (/sys/kernel/mm/transparent_hugepage) is not writable by the current user. Error was: [Errno 13] Permission denied: '/sys/kernel/mm/transparent_hugepage/.ansible_tmpvJ5yJYenabled'"
}
# Shell command -vvv output:
changed: [qa-invision-celery-broker-1] => {
"changed": true,
"cmd": "echo \"never\" > /sys/kernel/mm/transparent_hugepage/enabled",
"delta": "0:00:00.002098",
"end": "2017-02-05 01:00:03.211818",
"invocation": {
"module_args": {
"_raw_params": "echo \"never\" > /sys/kernel/mm/transparent_hugepage/enabled",
"_uses_shell": true,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"warn": true
},
"module_name": "command"
},
"rc": 0,
"start": "2017-02-05 01:00:03.209720",
"stderr": "",
"stdout": "",
"stdout_lines": [],
"warnings": []
}
# Shell command "cat <path>" -vvv output
fatal: [qa-invision-celery-broker-1]: FAILED! => {
"changed": true,
"cmd": [
"cat",
"/sys/kernel/mm/transparent_hugepage/enabled"
],
"delta": "0:00:00.002406",
"end": "2017-02-05 01:00:06.221130",
"failed": true,
"failed_when_result": true,
"invocation": {
"module_args": {
"_raw_params": "cat /sys/kernel/mm/transparent_hugepage/enabled",
"_uses_shell": false,
"chdir": null,
"creates": null,
"executable": null,
"removes": null,
"warn": true
},
"module_name": "command"
},
"rc": 0,
"start": "2017-02-05 01:00:06.218724",
"stderr": "",
"stdout": "always madvise [never]",
"stdout_lines": [
"always madvise [never]"
],
"warnings": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment