initial commit
This commit is contained in:
parent
79cc857a46
commit
c7849945c3
10
files/bash_completion
Normal file
10
files/bash_completion
Normal file
@ -0,0 +1,10 @@
|
||||
function _connect() {
|
||||
COMPREPLY=()
|
||||
local currentWord=${COMP_WORDS[COMP_CWORD]}
|
||||
local completeHosts=$(cat /etc/passwd|grep "/var/www/sites"|cut -d ':' -f 1)
|
||||
|
||||
COMPREPLY=($(compgen -W "$completeHosts" -- "$currentWord"))
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -F _connect groot
|
41
files/groot
Normal file
41
files/groot
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
function _help() {
|
||||
echo "\
|
||||
.^. . _
|
||||
/: ||\`\/ \~ ,
|
||||
, [ & / \ y'
|
||||
{v': \`\ / \`&~-,
|
||||
'y. ' |\` . ' /
|
||||
\ ' . , y
|
||||
v . ' v
|
||||
V .~. .~. V
|
||||
: ( 0) ( 0) :
|
||||
i \`'\` \`'\` j
|
||||
i __ ,j
|
||||
\`%\`~....~'&
|
||||
<~o' / \\/\` \-s,
|
||||
o.~'. )( r .o ,.
|
||||
o', %\`\`\\/\`\`& : 'bF
|
||||
d', ,ri.~~-~.ri , +h
|
||||
\`oso' d\`~..~\`b 'sos\`
|
||||
d\`+ II +\`b
|
||||
i_:_yi_;_y I am groot! (C)"
|
||||
echo
|
||||
echo "No argument given !"
|
||||
echo "Usage: groot <TAB>" >&2
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
function _connect() {
|
||||
sudo su - $1 -s /bin/bash
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
_help
|
||||
else
|
||||
echo -e "\n\033[1;35mEntering $1 environment...\033[00m\n"
|
||||
_connect $1
|
||||
fi
|
||||
|
9
meta/main.yml
Normal file
9
meta/main.yml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
galaxy_info:
|
||||
author: Ludovic Cartier
|
||||
description: Very simple impersonate wrapper
|
||||
company: brainsys
|
||||
license: GPLv3
|
||||
min_ansible_version: 2.8
|
||||
issue_tracker_url: https://git.brainsys.io/ansible-roles/groot/issues
|
||||
github_branch: main
|
28
tasks/main.yml
Normal file
28
tasks/main.yml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
- name: groot | copy bash-completion
|
||||
copy:
|
||||
src: bash_completion
|
||||
dest: /etc/bash_completion.d/groot
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
tags: ['groot']
|
||||
|
||||
- name: groot | copy script
|
||||
copy:
|
||||
src: groot
|
||||
dest: /usr/local/bin/groot
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
tags: ['groot']
|
||||
|
||||
- name: groot | create sudo priv
|
||||
template:
|
||||
src: sudoers.j2
|
||||
dest: /etc/sudoers.d/groot
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0440
|
||||
validate: "/usr/sbin/visudo -cf %s"
|
||||
with_dict: "{{ groot }}"
|
9
templates/sudoers.j2
Normal file
9
templates/sudoers.j2
Normal file
@ -0,0 +1,9 @@
|
||||
# {{ ansible_managed }}
|
||||
{% for user in groot %}
|
||||
|
||||
Defaults:{{ user }} !requiretty
|
||||
{% for command in item.value -%}
|
||||
{{ user }} ALL=(ALL:ALL) NOPASSWD: {{ command }}
|
||||
{% endfor -%}
|
||||
|
||||
{% endfor %}
|
Loading…
Reference in New Issue
Block a user