single-step script to perform all administration, some ansible performance settings
This commit is contained in:
parent
0ca44cc623
commit
4fda00bfb5
|
@ -23,6 +23,10 @@ EOF
|
||||||
cat > ansible.cfg << EOF
|
cat > ansible.cfg << EOF
|
||||||
[defaults]
|
[defaults]
|
||||||
inventory = $(pwd)/hosts
|
inventory = $(pwd)/hosts
|
||||||
|
|
||||||
|
[ssh_connection]
|
||||||
|
ssh_args = "-o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey"
|
||||||
|
pipelining = true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
ansible "$CATEGORY" -m ping
|
ansible "$CATEGORY" -m ping
|
||||||
|
|
|
@ -34,6 +34,10 @@ EOF
|
||||||
cat > ansible.cfg << EOF
|
cat > ansible.cfg << EOF
|
||||||
[defaults]
|
[defaults]
|
||||||
inventory = $(pwd)/hosts
|
inventory = $(pwd)/hosts
|
||||||
|
|
||||||
|
[ssh_connection]
|
||||||
|
ssh_args = "-o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey"
|
||||||
|
pipelining = true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
ansible "$CATEGORY" -m ping
|
ansible "$CATEGORY" -m ping
|
||||||
|
|
|
@ -39,6 +39,10 @@ EOF
|
||||||
cat > ansible.cfg << EOF
|
cat > ansible.cfg << EOF
|
||||||
[defaults]
|
[defaults]
|
||||||
inventory = $(pwd)/hosts
|
inventory = $(pwd)/hosts
|
||||||
|
|
||||||
|
[ssh_connection]
|
||||||
|
ssh_args = "-o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey"
|
||||||
|
pipelining = true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
ansible "$CATEGORY" -m ping
|
ansible "$CATEGORY" -m ping
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Install Jupyterhub
|
- name: Install Jupyterhub
|
||||||
hosts: UpskillChallengeNode
|
hosts: UpskillChallengeNode
|
||||||
|
gather_facts: no
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Create NodeJS directory
|
- name: Create NodeJS directory
|
||||||
|
@ -23,7 +24,7 @@
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: run NodeJS configuration script
|
- name: run NodeJS configuration script
|
||||||
ansible.builtin.shell: setup_14.x
|
ansible.builtin.shell: /opt/nodesource/setup_14.x
|
||||||
args:
|
args:
|
||||||
chdir: /opt/nodesource
|
chdir: /opt/nodesource
|
||||||
creates: /etc/apt/sources.list.d/nodesource.list
|
creates: /etc/apt/sources.list.d/nodesource.list
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
d ()
|
||||||
|
{
|
||||||
|
date '+%F %T'
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $(d): Starting server
|
||||||
|
ROOT_PASS="Swordfish4321!" ./day0_create.sh
|
||||||
|
./wait_ready.sh
|
||||||
|
./day1_geninventory.sh
|
||||||
|
echo $(d): Creating user account
|
||||||
|
ansible-playbook phase1user.yml > .phase1.log
|
||||||
|
./day3_geninventory_phase1.sh
|
||||||
|
echo $(d): Securing SSH access
|
||||||
|
ansible-playbook phase2user.yml > .phase2.log
|
||||||
|
./day3_geninventory_phase2.sh
|
||||||
|
echo $(d): configuring jupyterhub
|
||||||
|
ansible-playbook jupyterhubsrv.yml > .jupyterhub.log
|
||||||
|
echo $(d): ready
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Create admin user
|
- name: Create admin user
|
||||||
hosts: UpskillChallengeNode
|
hosts: UpskillChallengeNode
|
||||||
|
gather_facts: no
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
newusername: "tachyon"
|
newusername: "tachyon"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Lock down root & SSH on the server
|
- name: Lock down root & SSH on the server
|
||||||
hosts: UpskillChallengeNode
|
hosts: UpskillChallengeNode
|
||||||
|
gather_facts: no
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Disable root login over ssh
|
- name: Disable root login over ssh
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z ""]
|
||||||
|
then
|
||||||
|
LABEL="UpskillChallengeNode"
|
||||||
|
fi
|
||||||
|
|
||||||
|
NODESTATE="indeterminate"
|
||||||
|
while [ "$NODESTATE" != "running" ]
|
||||||
|
do
|
||||||
|
OLDSTATE=$NODESTATE
|
||||||
|
NODESTATE=$(linode-cli linodes list --format 'status' --label "$LABEL" --text | tail -n 1)
|
||||||
|
if [ "$NODESTATE" = "status" ]
|
||||||
|
then
|
||||||
|
echo "No node detected."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$NODESTATE" != "$OLDSTATE" ]
|
||||||
|
then
|
||||||
|
echo "$(date '+%F %T'): $NODESTATE"
|
||||||
|
fi
|
||||||
|
done
|
Reference in New Issue