Move ansible section to its function
This commit is contained in:
parent
35cc77bca6
commit
35cff1a7b9
|
@ -34,6 +34,34 @@ makeuser_no_ansible()
|
||||||
#sudo toot "welcome new user ~$1!"
|
#sudo toot "welcome new user ~$1!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
makeuser_ansible()
|
||||||
|
{
|
||||||
|
currdir=`pwd`
|
||||||
|
cd $REPO_LOCATION; git pull
|
||||||
|
echo "---
|
||||||
|
- name: Setting up $1
|
||||||
|
user:
|
||||||
|
name: $1
|
||||||
|
groups: tilde
|
||||||
|
state: present
|
||||||
|
skeleton: /etc/skel
|
||||||
|
shell: /bin/bash
|
||||||
|
system: no
|
||||||
|
createhome: yes
|
||||||
|
home: /home/$1
|
||||||
|
- authorized_key:
|
||||||
|
user: $1
|
||||||
|
state: present
|
||||||
|
key: \"$3\"" > $REPO_LOCATION/roles/shell/tasks/users/$YAML_FILE
|
||||||
|
|
||||||
|
echo "- include: users/$YAML_FILE" >> $REPO_LOCATION/roles/shell/tasks/users.yml
|
||||||
|
git add $REPO_LOCATION/roles/shell/tasks/users/$YAML_FILE
|
||||||
|
git commit -am "Adding user $1"
|
||||||
|
git push
|
||||||
|
cd $currdir
|
||||||
|
$GEN_TDP | sudo tee $TILDE_JSON
|
||||||
|
}
|
||||||
|
|
||||||
add_account_recovery()
|
add_account_recovery()
|
||||||
{
|
{
|
||||||
sudo mkdir -p --mode=700 /home/$1/.thunix
|
sudo mkdir -p --mode=700 /home/$1/.thunix
|
||||||
|
|
25
makeuser
25
makeuser
|
@ -30,30 +30,7 @@ case $1 in
|
||||||
add_account_recovery $1 $2
|
add_account_recovery $1 $2
|
||||||
|
|
||||||
#Thunix specific section
|
#Thunix specific section
|
||||||
currdir=`pwd`
|
makeuser_ansible $1 $2
|
||||||
cd $REPO_LOCATION; git pull
|
|
||||||
echo "---
|
|
||||||
- name: Setting up $1
|
|
||||||
user:
|
|
||||||
name: $1
|
|
||||||
groups: tilde
|
|
||||||
state: present
|
|
||||||
skeleton: /etc/skel
|
|
||||||
shell: /bin/bash
|
|
||||||
system: no
|
|
||||||
createhome: yes
|
|
||||||
home: /home/$1
|
|
||||||
- authorized_key:
|
|
||||||
user: $1
|
|
||||||
state: present
|
|
||||||
key: \"$3\"" > $REPO_LOCATION/roles/shell/tasks/users/$YAML_FILE
|
|
||||||
|
|
||||||
echo "- include: users/$YAML_FILE" >> $REPO_LOCATION/roles/shell/tasks/users.yml
|
|
||||||
git add $REPO_LOCATION/roles/shell/tasks/users/$YAML_FILE
|
|
||||||
git commit -am "Adding user $1"
|
|
||||||
git push
|
|
||||||
cd $currdir
|
|
||||||
$GEN_TDP | sudo tee $TILDE_JSON
|
|
||||||
# End Thunix specific section
|
# End Thunix specific section
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue