Skip to content

Commit

Permalink
Merge pull request #712 from Zarquan/20220517-zrq-user-accounts
Browse files Browse the repository at this point in the history
20220517-zrq-user-accounts - all the changes in one big commit
  • Loading branch information
stvoutsin authored May 18, 2022
2 parents 57ed7fb + aff793b commit 519febe
Show file tree
Hide file tree
Showing 42 changed files with 9,234 additions and 384 deletions.
29 changes: 29 additions & 0 deletions deployments/aglais/bin/aglais-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
#
# <meta:header>
# <meta:licence>
# Copyright (c) 2022, ROE (http://www.roe.ac.uk/)
#
# This information is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This information is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# </meta:licence>
# </meta:header>
#

echo "---- ----"
echo "date [$(date)]"
echo "host [$(hostname)]"
echo "PATH [${PATH}]"
echo "---- ----"


63 changes: 63 additions & 0 deletions deployments/aglais/bin/create-user-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/sh
#
# <meta:header>
# <meta:licence>
# Copyright (c) 2022, ROE (http://www.roe.ac.uk/)
#
# This information is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This information is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# </meta:licence>
# </meta:header>
#
#

# -----------------------------------------------------
# Settings ...

# set -eu
# set -o pipefail
#
# binfile="$(basename ${0})"
# binpath="$(dirname $(readlink -f ${0}))"
# treetop="$(dirname $(dirname ${binpath}))"
#
# echo ""
# echo "---- ---- ----"
# echo "File [${binfile}]"
# echo "Path [${binpath}]"
# echo "Tree [${treetop}]"
# echo "---- ---- ----"
#


# get the next available uid
# https://www.commandlinefu.com/commands/view/5684/determine-next-available-uid
getnextuid()
{
getent passwd | awk -F: '($3>600) && ($3<60000) && ($3>maxuid) { maxuid=$3; } END { print maxuid+1; }'
}


# Generate a new password hash.
newpasshash()
{
local password="${1:?}"
java \
-jar "${HOME}/lib/shiro-tools-hasher.jar" \
-i 500000 \
-f shiro1 \
-a SHA-256 \
-gss 128 \
'${password:?}'
}

51 changes: 51 additions & 0 deletions deployments/common/users/test-users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# <meta:header>
# <meta:licence>
# Copyright (c) 2022, ROE (http://www.roe.ac.uk/)
#
# This information is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This information is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# </meta:licence>
# </meta:header>
#
#

test-users:

- name: "Nelia"
uuid: "5cf0cf95-157e-4a40-b95e-b163f22c2d92"
uid: 2050
gid: 2050
home: "/home/Nelia"
data:
path: "/user/Nelia"
size: "20"

- name: "Ghoria"
uuid: "237983b5-a21f-47c8-8fb3-80cbbc70ba56"
uid: 2051
home: "/home/Ghoria"
data:
path: "/user/Ghoria"

- name: "Nalla"
uuid: "65c7aeb1-3c2a-43b7-acc0-8c4497997c70"
uid: 2052
home: "/home/Nalla"

- name: "Wenia"
uid: 2053

- name: "Ava"


12 changes: 6 additions & 6 deletions deployments/common/zeppelin/sql/auth-test.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
USE zeppelin;
CREATE TABLE users (username TEXT, password TEXT, password_salt TEXT);
CREATE TABLE user_roles (username TEXT, role_name TEXT);
CREATE TABLE user_permissions (username TEXT, permission TEXT);
GRANT ALL PRIVILEGES ON zeppelin.users TO 'zeppelin'@'localhost';
GRANT ALL PRIVILEGES ON zeppelin.user_roles TO 'zeppelin'@'localhost';
GRANT ALL PRIVILEGES ON zeppelin.user_permissions TO 'zeppelin'@'localhost';
--CREATE TABLE users (username TEXT, password TEXT, password_salt TEXT);
--CREATE TABLE user_roles (username TEXT, role_name TEXT);
--CREATE TABLE user_permissions (username TEXT, permission TEXT);
--GRANT ALL PRIVILEGES ON zeppelin.users TO 'zeppelin'@'localhost';
--GRANT ALL PRIVILEGES ON zeppelin.user_roles TO 'zeppelin'@'localhost';
--GRANT ALL PRIVILEGES ON zeppelin.user_permissions TO 'zeppelin'@'localhost';

# Create test users

Expand Down
12 changes: 6 additions & 6 deletions deployments/common/zeppelin/sql/auth.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
USE zeppelin;
CREATE TABLE users (username TEXT, password TEXT, password_salt TEXT);
CREATE TABLE user_roles (username TEXT, role_name TEXT);
CREATE TABLE user_permissions (username TEXT, permission TEXT);
GRANT ALL PRIVILEGES ON zeppelin.users TO 'zeppelin'@'localhost';
GRANT ALL PRIVILEGES ON zeppelin.user_roles TO 'zeppelin'@'localhost';
GRANT ALL PRIVILEGES ON zeppelin.user_permissions TO 'zeppelin'@'localhost';
--CREATE TABLE users (username TEXT, password TEXT, password_salt TEXT);
--CREATE TABLE user_roles (username TEXT, role_name TEXT);
--CREATE TABLE user_permissions (username TEXT, permission TEXT);
--GRANT ALL PRIVILEGES ON zeppelin.users TO 'zeppelin'@'localhost';
--GRANT ALL PRIVILEGES ON zeppelin.user_roles TO 'zeppelin'@'localhost';
--GRANT ALL PRIVILEGES ON zeppelin.user_permissions TO 'zeppelin'@'localhost';


INSERT INTO users (username, password) VALUES ('gaiauser', '$shiro1$SHA-256$500...........R0GxWVAH028tjMyIkbKmMDW2E0=');
Expand Down
93 changes: 93 additions & 0 deletions deployments/hadoop-yarn/ansible/10-install-aglais.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#
# <meta:header>
# <meta:licence>
# Copyright (c) 2022, ROE (http://www.roe.ac.uk/)
#
# This information is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This information is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# </meta:licence>
# </meta:header>
#
#


---
- name: "Install Aglais tools"
hosts: zeppelin
gather_facts: false
vars_files:
- config/aglais.yml
- config/ansible.yml
- config/zeppelin.yml
- /tmp/ansible-vars.yml
tasks:

- name: "Create Aglais directory [{{aghome}}]"
become: true
ansible.builtin.file:
path: '{{aghome}}'
owner: 'root'
group: 'root'
state: directory
mode: 'u=rwx,g=rwx,o=rx'

- name: "Create Aglais bin directory [{{aghome}}/bin]"
become: true
ansible.builtin.file:
path: '{{aghome}}/bin'
owner: 'root'
group: 'root'
state: directory
mode: 'u=rwx,g=rwx,o=rx'

- name: "Create Aglais lib directory [{{aghome}}/lib]"
become: true
ansible.builtin.file:
path: '{{aghome}}/lib'
owner: 'root'
group: 'root'
state: directory
mode: 'u=rwx,g=rwx,o=rx'

- name: "Create Aglais tmp directory [{{aghome}}/tmp]"
become: true
ansible.builtin.file:
path: '{{aghome}}/tmp'
owner: "{{zepuser}}"
group: "{{zepuser}}"
state: directory
mode: 'u=rwx,g=rwx,o=rx'

- name: "Copy Aglais tools to [{{aghome}}/bin]"
become: true
ansible.builtin.copy:
src: '{{playbook_dir | dirname | dirname }}/aglais/bin/'
dest: '{{aghome}}/bin'
owner: 'root'
group: 'root'
mode: 'u=rwx,g=rwx,o=rx'

- name: "Create [/etc/profile.d/aglais.sh]"
become: true
ansible.builtin.blockinfile:
dest: '/etc/profile.d/aglais.sh'
state: present
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o=r'
create: true
insertafter: 'EOF'
marker: '# {mark} Ansible managed configuration'
block: |
export PATH=${PATH}:{{aghome}}/bin
26 changes: 23 additions & 3 deletions deployments/hadoop-yarn/ansible/27-install-zeppelin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<property>
<name>zeppelin.server.addr</name>
<value>{{ hostvars['zeppelin'].ansible_default_ipv4.address }}</value>
<value>0.0.0.0</value>
<description>Server binding address</description>
</property>
Expand Down Expand Up @@ -218,12 +218,18 @@
</configuration>
tasks:
- name: "Install Zeppelin"

- name: "Download and install Zeppelin"
unarchive:
src: "https://downloads.apache.org/zeppelin/{{zepname}}/{{zepname}}-bin-all.tgz"
src: "https://downloads.apache.org/zeppelin/zeppelin-{{zepvers}}/{{zepname}}.tgz"
dest: "{{zepbase}}"
remote_src: true

- name: "Symlink Zeppelin"
ansible.builtin.file:
src: "{{zepbase}}/{{zepname}}"
dest: "{{zepbase}}/zeppelin"
state: link

- name: "Create [/etc/profile.d/zeppelin.sh]"
become: true
Expand Down Expand Up @@ -274,6 +280,20 @@
group: "{{zepuser}}"
mode: 0775

- name: "Create [/etc/profile.d/zeppelin.sh]"
become: true
ansible.builtin.blockinfile:
dest: '/etc/profile.d/zeppelin.sh'
state: present
owner: 'root'
group: 'root'
mode: 'u=rw,g=r,o=r'
create: true
insertafter: 'EOF'
marker: '# {mark} Ansible managed configuration'
block: |
export PATH=${PATH}:{{zephome}}/bin
- name: "Add group for Zeppelin Users"
become: true
command: groupadd {{ zepusersgroup }}
Loading

0 comments on commit 519febe

Please sign in to comment.