restrict playbook execution from specific directory
15 views
Skip to first unread message
K T
unread,
Aug 7, 2023, 10:37:29 AM8/7/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi,
Is there a way to restrict playbook execution from specific directory?
For example: I don't want user to execute playbook from home directory and I want to enforce it to be executed from only defined ansible directory
Brian Coca
unread,
Aug 7, 2023, 10:48:10 AM8/7/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Not an explicit feature, but I can think of a few ways you could do this:
- Have an assert/fail at the start of the playbook that checks
``playbook_dir`` is in the 'allowed paths'.
- Setup selinux/apparmor policies to restrict what files
ansible-playbook can access.
- Add to the check to a custom plugin you always load (callback/connection/?).
- Use a wrapper script or shell alias function that does the check and
then calls the 'real' Ansible CLI.
----------
Brian Coca
K T
unread,
Aug 7, 2023, 10:25:21 PM8/7/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message