Commit 459e7225 authored by Joanne Hugé's avatar Joanne Hugé

playbook/ors-upgrade: configure network and sshd

parent b7f10319
Pipeline #23214 canceled with stage
in 0 seconds
#!/bin/bash #!/bin/bash
CONF="/etc/re6stnet/re6stnet.conf" CONF="/etc/network/interfaces"
BAK="/tmp/interfaces.$(date +%s)"
IFACE="$(ip route | grep default | sed 's/.*dev \(\w*\)\( .*$\|$\)/\1/g')" IFACE="$(ip route | grep default | sed 's/.*dev \(\w*\)\( .*$\|$\)/\1/g')"
cp $CONF $BAK;
if ! grep -q ip6tables $CONF; then
sed -i 's#^\(\s*post-up \)iptables\(.*\)$#\1iptables\2\n\1ip6tables\2#g' $CONF;
fi
if ! ifup --no-act $IFACE; then
cp $BAK $CONF;
fi
rm -rf $BAK;
CONF="/etc/re6stnet/re6stnet.conf"
sed -i '/^interface/d' $CONF sed -i '/^interface/d' $CONF
echo "interface $IFACE" >> $CONF echo "interface $IFACE" >> $CONF
if ! ps -ax -o cmd | grep babeld | grep -q $IFACE; then if ! ps -ax -o cmd | grep babeld | grep -q $IFACE; then
......
#!/bin/bash
CONF="/etc/ssh/sshd_config"
if ! grep -q "^PermitRootLogin yes$" $CONF; then
sed -i '/^PermitRootLogin/d' $CONF;
echo "PermitRootLogin yes" >> $CONF;
systemctl restart sshd;
fi
if ! grep -q "^PasswordAuthentication yes$" $CONF; then
sed -i '/^PasswordAuthentication/d' $CONF;
echo "PasswordAuthentication yes" >> $CONF;
systemctl restart sshd;
fi
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
- name: Enable init-sdr - name: Enable init-sdr
systemd: name=init-sdr enabled=yes systemd: name=init-sdr enabled=yes
- name: Configure re6st - name: Configure network
script: configure-re6st.sh script: configure-network.sh
- name: Configure ssh
script: configure-ssh.sh
- name: Configure slapos - name: Configure slapos
script: configure-slapos.py script: configure-slapos.py
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment