basic_settings.sh revision bb540b02
1#!/bin/bash
2# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
3##############################################################################
4# Copyright (c) 2016 The Linux Foundation and others.
5#
6# All rights reserved. This program and the accompanying materials
7# are made available under the terms of the Eclipse Public License v1.0
8# which accompanies this distribution, and is available at
9# http://www.eclipse.org/legal/epl-v10.html
10##############################################################################
11
12case "$(facter operatingsystem)" in
13  Ubuntu)
14    apt-get update
15    # make sure that the ca-certs are properly updated
16    /usr/sbin/update-ca-certificates
17
18    # attach to the fd.io.dev apt repo
19    echo 'deb http://nexus.fd.io/content/repositories/fd.io.dev/ ./' >> /etc/apt/sources.list
20
21    # Configure Ubuntu mirror
22    perl -pi -e 'unless(m{(security|fd\.io)}){ s{://[^/]+/}{://ca.archive.ubuntu.com/ubuntu/ } }' /etc/apt/sources.list
23    ;;
24  *)
25    # Do nothing on other distros for now
26    ;;
27esac
28
29IPADDR=$(facter ipaddress)
30HOSTNAME=$(facter hostname)
31FQDN=$(facter fqdn)
32
33echo "${IPADDR} ${HOSTNAME} ${FQDN}" >> /etc/hosts
34
35#Increase limits
36cat <<EOF > /etc/security/limits.d/jenkins.conf
37jenkins         soft    nofile          16000
38jenkins         hard    nofile          16000
39EOF
40
41cat <<EOJENKINS_SUDO >/etc/sudoers.d/89-jenkins-user-defaults
42Defaults:jenkins !requiretty
43jenkins     ALL = NOPASSWD: ALL
44EOJENKINS_SUDO
45
46cat <<EOSSH >> /etc/ssh/ssh_config
47Host *
48  ServerAliveInterval 60
49
50# we don't want to do SSH host key checking on spin-up systems
51# Don't use CIDR since SSH won't parse it
52# 10.30.48.0/23
53Host 10.30.48.* 10.30.49.*
54  StrictHostKeyChecking no
55  UserKnownHostsFile /dev/null
56EOSSH
57
58cat <<EOKNOWN >  /etc/ssh/ssh_known_hosts
59[gerrit.fd.io]:29418,[162.253.54.31]:29418 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC76FxV43JIk/HpI5JUZfizmak9znK/QzsjPoNHt/Eo2Vp68kvJIRZ+PzI7RJR0NsdsXlyqzRsGuH+Cj99ZuLVjNMqz1Y1A5y6itYAgT42KDcnV/JoPx6WV+THdQ+oMSp2dINtvD1kc6Om8iAA2CwYOfIZ/FQS5A9OX2xzFopo4qAN3nRk9kpcHyC698R5SDNZBbk6eqlsBz0827KJrSpOSEEMBhtroBM4JV8vImcSWeJuQ5QFdZgQdQaI8R5YFBRbWu3mDSgJfjJk89xT2CkUiqIynNJeiQMM4IZxcdQB3zJ1RUEJepxv77yV09NZ8jwhaN6X659UJZjsCZ5ffvc77
60EOKNOWN
61
62# vim: sw=2 ts=2 sts=2 et :
63