diff --git a/README.md b/README.md index 7bc4a204e573ded3ea6e5218a51f3f77250ec512..1ec1828adf913b097f9dd95c7a62a3b3fae65c58 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,11 @@ Basic server configuration used for most unix based servers at HsH. ## States * apt +* openvmtools + * iptables * locale -* open-vm-tools + ## Configuration diff --git a/hshbase/apt/files/SALTSTACK-GPG-KEY.pub b/hshbase/apt/files/SALTSTACK-GPG-KEY.pub new file mode 100644 index 0000000000000000000000000000000000000000..919f2724cc44aa596ac466e7058c6b87c2fefaa4 --- /dev/null +++ b/hshbase/apt/files/SALTSTACK-GPG-KEY.pub @@ -0,0 +1,31 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2.0.22 (GNU/Linux) + +mQENBFOpvpgBCADkP656H41i8fpplEEB8IeLhugyC2rTEwwSclb8tQNYtUiGdna9 +m38kb0OS2DDrEdtdQb2hWCnswxaAkUunb2qq18vd3dBvlnI+C4/xu5ksZZkRj+fW +tArNR18V+2jkwcG26m8AxIrT+m4M6/bgnSfHTBtT5adNfVcTHqiT1JtCbQcXmwVw +WbqS6v/LhcsBE//SHne4uBCK/GHxZHhQ5jz5h+3vWeV4gvxS3Xu6v1IlIpLDwUts +kT1DumfynYnnZmWTGc6SYyIFXTPJLtnoWDb9OBdWgZxXfHEcBsKGha+bXO+m2tHA +gNneN9i5f8oNxo5njrL8jkCckOpNpng18BKXABEBAAG0MlNhbHRTdGFjayBQYWNr +YWdpbmcgVGVhbSA8cGFja2FnaW5nQHNhbHRzdGFjay5jb20+iQE4BBMBAgAiBQJT +qb6YAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRAOCKFJ3le/vhkqB/0Q +WzELZf4d87WApzolLG+zpsJKtt/ueXL1W1KA7JILhXB1uyvVORt8uA9FjmE083o1 +yE66wCya7V8hjNn2lkLXboOUd1UTErlRg1GYbIt++VPscTxHxwpjDGxDB1/fiX2o +nK5SEpuj4IeIPJVE/uLNAwZyfX8DArLVJ5h8lknwiHlQLGlnOu9ulEAejwAKt9CU +4oYTszYM4xrbtjB/fR+mPnYh2fBoQO4d/NQiejIEyd9IEEMd/03AJQBuMux62tjA +/NwvQ9eqNgLw9NisFNHRWtP4jhAOsshv1WW+zPzu3ozoO+lLHixUIz7fqRk38q8Q +9oNR31KvrkSNrFbA3D89uQENBFOpvpgBCADJ79iH10AfAfpTBEQwa6vzUI3Eltqb +9aZ0xbZV8V/8pnuU7rqM7Z+nJgldibFk4gFG2bHCG1C5aEH/FmcOMvTKDhJSFQUx +uhgxttMArXm2c22OSy1hpsnVG68G32Nag/QFEJ++3hNnbyGZpHnPiYgej3FrerQJ +zv456wIsxRDMvJ1NZQB3twoCqwapC6FJE2hukSdWB5yCYpWlZJXBKzlYz/gwD/Fr +GL578WrLhKw3UvnJmlpqQaDKwmV2s7MsoZogC6wkHE92kGPG2GmoRD3ALjmCvN1E +PsIsQGnwpcXsRpYVCoW7e2nW4wUf7IkFZ94yOCmUq6WreWI4NggRcFC5ABEBAAGJ +AR8EGAECAAkFAlOpvpgCGwwACgkQDgihSd5Xv74/NggA08kEdBkiWWwJZUZEy7cK +WWcgjnRuOHd4rPeT+vQbOWGu6x4bxuVf9aTiYkf7ZjVF2lPn97EXOEGFWPZeZbH4 +vdRFH9jMtP+rrLt6+3c9j0M8SIJYwBL1+CNpEC/BuHj/Ra/cmnG5ZNhYebm76h5f +T9iPW9fFww36FzFka4VPlvA4oB7ebBtquFg3sdQNU/MmTVV4jPFWXxh4oRDDR+8N +1bcPnbB11b5ary99F/mqr7RgQ+YFF0uKRE3SKa7a+6cIuHEZ7Za+zhPaQlzAOZlx +fuBmScum8uQTrEF5+Um5zkwC7EXTdH1co/+/V/fpOtxIg4XO4kcugZefVm5ERfVS +MA== +=dtMN +-----END PGP PUBLIC KEY BLOCK----- diff --git a/hshbase/apt/sources.tpl b/hshbase/apt/files/sources.list similarity index 100% rename from hshbase/apt/sources.tpl rename to hshbase/apt/files/sources.list diff --git a/hshbase/apt/sources.tpl.d/salt.list b/hshbase/apt/files/sources.list.d/salt.list similarity index 100% rename from hshbase/apt/sources.tpl.d/salt.list rename to hshbase/apt/files/sources.list.d/salt.list diff --git a/hshbase/apt/init.sls b/hshbase/apt/init.sls index 68a8cf0b62ab7dfe30d4a2e97aa58327b11de05e..ac12814bc733916232605ba5debbae0a7fb4a03e 100644 --- a/hshbase/apt/init.sls +++ b/hshbase/apt/init.sls @@ -10,7 +10,7 @@ include: hsh_apt_sources_list: file.managed: - name: /etc/apt/sources.list - - source: salt://hahbase/apt/sources.tpl + - source: salt://hshbase/apt/files/sources.list - template: jinja - mode: 644 - user: root @@ -19,11 +19,11 @@ hsh_apt_sources_list: {% if grains['os'] == 'Debian' and oscodename == 'jessie' %} hsh_apt_sources_d_salt_jessie: pkgrepo.managed: - - humanname: deb-salt + - humanname: deb-saltstack - name: deb http://repo.saltstack.com/apt/debian/latest {{ oscodename }} main - - file: /etc/apt/sources.list.d/salt.list + - file: /etc/apt/sources.list.d/saltstack.list - gpgcheck: 1 - - key_url: salt://apt-sources/SALTSTACK-GPG-KEY.pub + - key_url: salt://hshbase/apt/files/SALTSTACK-GPG-KEY.pub {% endif %} diff --git a/hshbase/apt/proxy.sls b/hshbase/apt/proxy.sls index 291f38ed752376102e08acc86270e74bd05ffb6e..a3489e85d0f72494918ef7bc635995605a652692 100644 --- a/hshbase/apt/proxy.sls +++ b/hshbase/apt/proxy.sls @@ -30,4 +30,18 @@ hsh_debian_apt_proxy: {% endif %} +{% else %} + +{% if grains['os'] == 'FreeBSD' %} +hsh_freebsd_remove_apt_proxy_folder: + file.absent: + - name: /usr/local/etc/pkg/repos + +{% elif grains['os'] == 'Debian' or grains['os'] == 'Ubuntu' %} +hsh_debian_remove_apt_proxy: + file.absent: + - name: /etc/apt/apt.conf.d/02proxy + +{% endif %} + {% endif %} diff --git a/hshbase/defaults.yaml b/hshbase/defaults.yaml index a6ee3bbb449e9f3d8e9ecd0c06a2405764a77439..e88b8002fbbe7c23c5fcc5b00c183a749e840d08 100644 --- a/hshbase/defaults.yaml +++ b/hshbase/defaults.yaml @@ -2,3 +2,7 @@ hshbase: apt: proxy: True proxy_address: http://apt-proxy.it.hs-hannover.de:8080 + openvmtools: True + time: + server: time.rz.fh-hannover.de + zone: Europe/Berlin diff --git a/hshbase/init.sls b/hshbase/init.sls index e401adba9bcfd881450b8f657d82f7a01805c926..60d3c73525bf5dac5be7c0ea765c4023656efe59 100644 --- a/hshbase/init.sls +++ b/hshbase/init.sls @@ -3,7 +3,6 @@ # Include all submodules by default. include: - - hshbase.apt - -echo "hshbase is under construction look at the issue tracker!": - cmd.run + - .apt + - .openvmtools + - .time diff --git a/hshbase/openvmtools.sls b/hshbase/openvmtools.sls new file mode 100644 index 0000000000000000000000000000000000000000..1e0fb768a83d504b40758b2b0f32fb74f71b05e8 --- /dev/null +++ b/hshbase/openvmtools.sls @@ -0,0 +1,19 @@ +{% from "hshbase/map.jinja" import hshbase with context %} + +{% if hshbase.openvmtools %} + +# For Debian/Ubuntu >6, wheezy packages have different names. +# Also, wheezy packages don't work, so they still get vmware stuff! +{% if grains['os'] in ['Debian', 'Ubuntu'] and grains['oscodename'] not in ['squeeze', 'wheezy'] %} +hsh_openvmtools: + pkg.installed: + - pkgs: [open-vm-tools, open-vm-tools-dkms] + +{% elif grains['os'] == 'FreeBSD' %} +hsh_openvmtools: + pkg.installed: + - pkgs: [open-vm-tools-nox11] + +{% endif %} + +{% endif %} diff --git a/hshbase/time/files/ntp.conf b/hshbase/time/files/ntp.conf new file mode 100644 index 0000000000000000000000000000000000000000..fb50ebe038e6f9c55ce344b66dadb040e55c5126 --- /dev/null +++ b/hshbase/time/files/ntp.conf @@ -0,0 +1,32 @@ +# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help + +driftfile /var/lib/ntp/ntp.drift + + +# Enable this if you want statistics to be logged. +#statsdir /var/log/ntpstats/ + +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable + + +# You do need to talk to an NTP server or two (or three). +server time.rz.fh-hannover.de iburst + +# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will +# pick a different set every time it starts up. Please consider joining the +# pool: <http://www.pool.ntp.org/join.html> +server 0.debian.pool.ntp.org iburst +server 1.debian.pool.ntp.org iburst +server 2.debian.pool.ntp.org iburst +server 3.debian.pool.ntp.org iburst + +# By default, exchange time with everybody, but don't allow configuration. +restrict -4 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery + +# Local users may interrogate the ntp server more closely. +restrict 127.0.0.1 +restrict ::1 diff --git a/hshbase/time/init.sls b/hshbase/time/init.sls new file mode 100644 index 0000000000000000000000000000000000000000..65b0df00134b6a9e67a62ced2728bca720ae8338 --- /dev/null +++ b/hshbase/time/init.sls @@ -0,0 +1,41 @@ +{% from "hshbase/map.jinja" import hshbase with context %} + +{% if grains['os'] in ('Debian', 'Ubuntu') %} +ntp: + pkg.installed + +/etc/ntp.conf: + file.managed: + - source: salt://hshbase/time/files/ntp.conf + - template: jinja + - context: + hshbase: hshbase + - require: + - pkg: ntp + +{% if grains['os'] == 'Debian' and grains['oscodename'] != 'jessie' %} +hsh_ntp_service_running: + service.running: + - name: ntp + - reload: True + - enable: True + - watch: + - file: /etc/ntp.conf + - require: + - file: /etc/ntp.conf + - pkg: ntp + +{% else %} +{# We are not waiting for ntp here! Read this:\n* https://github.com/systemd/systemd/issues/937\n* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=635752 #} + +{% endif %} + +hsh_server_timezone: + timezone.system: + - name: {{ hshbase.time.zone }} + +{% elif grains['os'] == 'FreeBSD' %} + +{# TODO: Manage /etc/ntp.conf file. #} + +{% endif %} diff --git a/pillar.example b/pillar.example index 3f2a853bba8566407b946866ce1fbad22fa8f382..68b56691cdc7f8f541368768e9579030bf7333cf 100644 --- a/pillar.example +++ b/pillar.example @@ -1,3 +1,5 @@ hshbase: apt: proxy: True # if you do not want to to use apt-proxy: set to False + proxy_address: http://apt-proxy.it.hs-hannover.de:8080 + openvmtools: True