diff --git a/userdata/README.md b/userdata/README.md new file mode 100644 index 0000000..57df916 --- /dev/null +++ b/userdata/README.md @@ -0,0 +1,2 @@ +# E.G. to boot 20 instances +openstack server create --user-data ansible101.sh --min 20 --max 20 --flavor d2-4 --image 'Debian 11' --net Ext-Net --key-name arnaud-choupinette isen- diff --git a/userdata/ansible101.sh b/userdata/ansible101.sh index 104337a..9dead03 100644 --- a/userdata/ansible101.sh +++ b/userdata/ansible101.sh @@ -26,7 +26,9 @@ function title.print { exec &> >(log_handler) title.print "Permit root login" +sed -i '/PasswordAuthentication no/d' /etc/ssh/sshd_config echo 'PasswordAuthentication yes' >> /etc/ssh/sshd_config +sed -i '/PermitRootLogin no/d' /etc/ssh/sshd_config echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config echo '' > /root/.ssh/authorized_keys echo -e "moutarde42\nmoutarde42" | passwd root @@ -50,7 +52,7 @@ wget https://www.arnaudmorin.fr/tmux.conf -O /root/.tmux.conf wget https://www.arnaudmorin.fr/plikrc -O /root/.plikrc wget https://www.arnaudmorin.fr/plik -O /usr/local/bin/plik chmod +x /usr/local/bin/plik -echo 'if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then tmux new-session -A -s ssh_tmux ;fi' >> /root/.bashrc +#echo 'if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then tmux new-session -A -s ssh_tmux ;fi' >> /root/.bashrc title.print "Install docker"