Ensure Ansible is not being run in a world writable directory

This commit is contained in:
Jack Ivanov 2019-10-31 19:56:24 +01:00
parent 52ffa9394b
commit 44cc720970

View file

@ -2,6 +2,16 @@
- hosts: localhost - hosts: localhost
become: false become: false
tasks: tasks:
- name: Playbook dir stat
stat:
path: "{{ playbook_dir }}"
register: _playbook_dir
- name: Ensure Ansible is not being run in a world writable directory
assert:
that: _playbook_dir.stat.mode|int <= 0775
msg: Ansible is being run in a world writable directory ({{ playbook_dir }}), ignoring it as an ansible.cfg source. For more information see https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
- name: Ensure the requirements installed - name: Ensure the requirements installed
debug: debug:
msg: "{{ '' | ipaddr }}" msg: "{{ '' | ipaddr }}"