single-step script to perform all administration, some ansible performance settings

This commit is contained in:
John McCardle 2022-02-10 18:35:07 -05:00
parent 0ca44cc623
commit 4fda00bfb5
8 changed files with 60 additions and 1 deletions

View File

@ -23,6 +23,10 @@ EOF
cat > ansible.cfg << EOF
[defaults]
inventory = $(pwd)/hosts
[ssh_connection]
ssh_args = "-o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey"
pipelining = true
EOF
ansible "$CATEGORY" -m ping

View File

@ -34,6 +34,10 @@ EOF
cat > ansible.cfg << EOF
[defaults]
inventory = $(pwd)/hosts
[ssh_connection]
ssh_args = "-o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey"
pipelining = true
EOF
ansible "$CATEGORY" -m ping

View File

@ -39,6 +39,10 @@ EOF
cat > ansible.cfg << EOF
[defaults]
inventory = $(pwd)/hosts
[ssh_connection]
ssh_args = "-o ControlMaster=auto -o ControlPersist=60s -o PreferredAuthentications=publickey"
pipelining = true
EOF
ansible "$CATEGORY" -m ping

View File

@ -1,6 +1,7 @@
---
- name: Install Jupyterhub
hosts: UpskillChallengeNode
gather_facts: no
tasks:
- name: Create NodeJS directory
@ -23,7 +24,7 @@
mode: 0755
- name: run NodeJS configuration script
ansible.builtin.shell: setup_14.x
ansible.builtin.shell: /opt/nodesource/setup_14.x
args:
chdir: /opt/nodesource
creates: /etc/apt/sources.list.d/nodesource.list

21
omniconfig.sh Executable file
View File

@ -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

View File

@ -1,6 +1,7 @@
---
- name: Create admin user
hosts: UpskillChallengeNode
gather_facts: no
vars:
newusername: "tachyon"

View File

@ -1,6 +1,7 @@
---
- name: Lock down root & SSH on the server
hosts: UpskillChallengeNode
gather_facts: no
tasks:
- name: Disable root login over ssh

23
wait_ready.sh Executable file
View File

@ -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