Add standalone installation option
This commit is contained in:
parent
2bff5fd4ed
commit
9610d0b733
1 changed files with 52 additions and 38 deletions
|
@ -233,7 +233,7 @@ function prepareInstallation() {
|
||||||
# INSTALLATION_TYPE=$(dialog --clear --title "Choose the main installation type of this host" --radiolist "Select one" 10 70 3 gaming Game-Server false proxy Proxy-Server false build Build-Server false 3>&1 1>&2 2>&3 3>&-)
|
# INSTALLATION_TYPE=$(dialog --clear --title "Choose the main installation type of this host" --radiolist "Select one" 10 70 3 gaming Game-Server false proxy Proxy-Server false build Build-Server false 3>&1 1>&2 2>&3 3>&-)
|
||||||
|
|
||||||
# standalone or managed
|
# standalone or managed
|
||||||
INSTALLATION_MODE=$(dialog --clear --title "Choose the main installation mode of this host" --radiolist "Select one" 10 70 3 controller Controller false managed Managed false 3>&1 1>&2 2>&3 3>&-)
|
INSTALLATION_MODE=$(dialog --clear --title "Choose the main installation mode of this host" --radiolist "Select one" 10 70 3 controller Controller false managed Managed false standalone Standalone false 3>&1 1>&2 2>&3 3>&-)
|
||||||
|
|
||||||
# show summary
|
# show summary
|
||||||
summary
|
summary
|
||||||
|
@ -392,20 +392,34 @@ function installation() {
|
||||||
installationSubtaskTitle "Set root shell"
|
installationSubtaskTitle "Set root shell"
|
||||||
runInChroot "chsh -s /usr/bin/fish root" || installationFailed
|
runInChroot "chsh -s /usr/bin/fish root" || installationFailed
|
||||||
|
|
||||||
installationSubtaskTitle "Create ansible user"
|
case "$INSTALLATION_MODE" in
|
||||||
runInChroot "adduser -s /usr/bin/fish -S -D ansible"
|
"controller")
|
||||||
|
installationSubtaskTitle "Create ansible user"
|
||||||
|
runInChroot "adduser -s /usr/bin/fish -S -D ansible"
|
||||||
|
|
||||||
installationSubtaskTitle "Enable ansible passwordless sudo"
|
installationSubtaskTitle "Enable ansible passwordless sudo"
|
||||||
runInChroot "echo 'ansible ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/ansible"
|
runInChroot "echo 'ansible ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/ansible"
|
||||||
|
|
||||||
if [[ "$INSTALLATION_MODE" == "controller" ]]; then
|
installationSubtaskTitle "Generate ansible ssh-keypair"
|
||||||
installationSubtaskTitle "Generate ansible ssh-keypair"
|
runInChroot "sudo -u ansible 'ssh-keygen -t ed25519 -P ""'" || installationFailed
|
||||||
runInChroot "sudo -u ansible 'ssh-keygen -t ed25519 -P ""'" || installationFailed
|
|
||||||
|
|
||||||
installationSubtaskTitle "Clone Playbook-repo"
|
installationSubtaskTitle "Clone Playbook-repo"
|
||||||
mkdir -p ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
mkdir -p ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
||||||
git clone ${INSTALLATION_ANSIBLE_GIT} ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
git clone ${INSTALLATION_ANSIBLE_GIT} ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
||||||
fi
|
;;
|
||||||
|
"managed")
|
||||||
|
installationSubtaskTitle "Create ansible user"
|
||||||
|
runInChroot "adduser -s /usr/bin/fish -S -D ansible"
|
||||||
|
|
||||||
|
installationSubtaskTitle "Enable ansible passwordless sudo"
|
||||||
|
runInChroot "echo 'ansible ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers.d/ansible"
|
||||||
|
;;
|
||||||
|
"standalone")
|
||||||
|
installationSubtaskTitle "Clone Playbook-repo"
|
||||||
|
mkdir -p ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
||||||
|
git clone ${INSTALLATION_ANSIBLE_GIT} ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
installationSubtaskTitle "Enable btrfs module"
|
installationSubtaskTitle "Enable btrfs module"
|
||||||
runInChroot "echo 'btrfs' >> /etc/modules"
|
runInChroot "echo 'btrfs' >> /etc/modules"
|
||||||
|
@ -417,36 +431,36 @@ function installation() {
|
||||||
runInChroot "rc-update add udev-settle sysinit"
|
runInChroot "rc-update add udev-settle sysinit"
|
||||||
runInChroot "rc-update add udev-postmount default"
|
runInChroot "rc-update add udev-postmount default"
|
||||||
|
|
||||||
# echo ""
|
|
||||||
# echo "┌──────────────────────────────────────────┐"
|
|
||||||
# echo "│ Configure Ansible and playbook-run │"
|
|
||||||
# echo "└──────────────────────────────────────────┘"
|
|
||||||
|
|
||||||
# installationSubtaskTitle "Clone Playbook-repo"
|
if [[ "$INSTALLATION_MODE" == "standalone" ]]; then
|
||||||
# mkdir -p ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
echo ""
|
||||||
# git clone ${INSTALLATION_ANSIBLE_GIT} ${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/playbooks
|
echo "┌──────────────────────────────────────────┐"
|
||||||
|
echo "│ Configure Ansible and playbook-run │"
|
||||||
|
echo "└──────────────────────────────────────────┘"
|
||||||
|
|
||||||
# mkdir -p ${INSTALLATION_MOUNTPOINT}/etc/ansible
|
mkdir -p ${INSTALLATION_MOUNTPOINT}/etc/ansible
|
||||||
# cat >"${INSTALLATION_MOUNTPOINT}/etc/ansible/ansible.cfg" <<EOT || installationFailed
|
cat >"${INSTALLATION_MOUNTPOINT}/etc/ansible/ansible.cfg" <<EOT || installationFailed
|
||||||
#[defaults]
|
[defaults]
|
||||||
#inventory=/${INSTALLATION_ANSIBLE_ROOT}/inventory.yml
|
inventory=/${INSTALLATION_ANSIBLE_ROOT}/inventory.yml
|
||||||
#EOT
|
EOT
|
||||||
|
|
||||||
# cat >"${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/inventory.yml" <<EOT
|
cat >"${INSTALLATION_MOUNTPOINT}/${INSTALLATION_ANSIBLE_ROOT}/inventory.yml" <<EOT
|
||||||
#ungrouped:
|
ungrouped:
|
||||||
# hosts:
|
hosts:
|
||||||
# localhost
|
localhost
|
||||||
# vars:
|
vars:
|
||||||
# ansible_connection: local
|
ansible_connection: local
|
||||||
# start_timestamp: ${START_TIMESTAMP}
|
start_timestamp: ${START_TIMESTAMP}
|
||||||
# tmpfs_size: 4G
|
tmpfs_size: 4G
|
||||||
# mysql_root_password: $(randomPasswordGen 32)
|
mysql_root_password: $(randomPasswordGen 32)
|
||||||
# release_version: %REL_VER%
|
release_version: %REL_VER%
|
||||||
# alpine_version: %ALP_VER%
|
alpine_version: %ALP_VER%
|
||||||
#EOT
|
EOT
|
||||||
|
|
||||||
|
installationSubtaskTitle "Execute Ansible playbooks"
|
||||||
|
runInChroot "ansible-playbook /${INSTALLATION_ANSIBLE_ROOT}/playbooks/standalone.ansible.yml" || installationFailed
|
||||||
|
fi
|
||||||
|
|
||||||
# installationSubtaskTitle "Execute Ansible playbooks"
|
|
||||||
# runInChroot "ansible-playbook /${INSTALLATION_ANSIBLE_ROOT}/playbooks/top.ansible.yml" || installationFailed
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "┌──────────────────────────────────────────┐"
|
echo "┌──────────────────────────────────────────┐"
|
||||||
|
|
Loading…
Reference in a new issue