Skip to content

Instantly share code, notes, and snippets.

@mattjbray
Last active December 27, 2015 11:19
Show Gist options
  • Save mattjbray/7318032 to your computer and use it in GitHub Desktop.
Save mattjbray/7318032 to your computer and use it in GitHub Desktop.
#!/bin/bash
# this script is not editable and should not be run as root
mkdir /tmp/permstest/subdir
---
- hosts: all
tasks:
- name: create permstest group
sudo: yes
group: name=permstest state=present
- name: create dir owner=root group=permstest mode=0775
sudo: yes
file: dest=/tmp/permstest owner=root group=permstest
state=directory mode=0775
- name: add ansible user to permstest group
sudo: yes
user: name={{ ansible_user_id }} groups=permstest
append=yes
- name: try to create subdir as ansible user
script: test-perms.sh
Vagrant.configure(2) do |config|
config.vm.box = "precise64"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "test-perms.yml"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment