Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
Regna committed Apr 16, 2016
0 parents commit bf63987
Show file tree
Hide file tree
Showing 65 changed files with 2,119 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**~
***#
6 changes: 6 additions & 0 deletions sls/augeas/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
augeas:
pkg.installed:
- refresh: false
- pkgs:
- app-admin/augeas: "~>=1.3.0"
- dev-python/python-augeas: "~>=0.5.0"
12 changes: 12 additions & 0 deletions sls/augeas/lenses.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include:
- augeas

{% set default_lenses = ['makeconf', 'confd'] %}
{% set extra_lenses = salt['pillar.get']('augeas_extra_lenses', []) %}

{% for lensname in default_lenses + extra_lenses %}
augeas-{{ lensname }}:
file.managed:
- name: /usr/share/augeas/lenses/{{ lensname }}.aug
- source: salt://augeas/lenses/{{ lensname }}.aug
{% endfor %}
8 changes: 8 additions & 0 deletions sls/augeas/lenses/confd.aug
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Confd =
autoload xfm

let lns = Shellvars.lns

let filter = (incl "/etc/conf.d/*") . (excl "net") . (excl "net.*") . (excl "*~") . (excl ".*") . (excl "#*#") . (excl "*.bak")

let xfm = transform lns filter
8 changes: 8 additions & 0 deletions sls/augeas/lenses/makeconf.aug
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Makeconf =
autoload xfm

let lns = Shellvars.lns

let filter = (incl "/etc/make.conf") . (incl "/etc/portage/make.conf")

let xfm = transform lns filter
21 changes: 21 additions & 0 deletions sls/bird/bird.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
log syslog { info, remote, warning, error, auth, fatal, bug };
router id 0.0.0.1;
# This pseudo-protocol performs synchronization between BIRD's routing
# tables and the kernel. If your kernel supports multiple routing tables
# (as Linux 2.2.x does), you can run multiple instances of the kernel
# protocol and synchronize different kernel tables with different BIRD tables.
protocol kernel {
learn; # Learn all alien routes from the kernel
persist; # Don't remove routes on bird shutdown
scan time 20; # Scan kernel routing table every 20 seconds
import all; # Default is import all
export none; # Default is export none
# kernel table 5; # Kernel table to synchronize with (default: main)
}

protocol bfd {
}
# This pseudo-protocol watches all interface up/down events.
protocol device {
scan time 10; # Scan interfaces every 10 seconds
}
41 changes: 41 additions & 0 deletions sls/bird/bird.initd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/sbin/runscript
# -*- mode: shell-script -*-
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

extra_started_commands="reload"

EXE="${SVCNAME}"
SOCK="/var/run/${EXE}.ctl"

depend() {
need net
use logger
}

checkconfig() {
if [ ! -f "/etc/${EXE}.conf" ]; then
eerror "Please create /etc/${EXE}.conf"
return 1
fi
return 0
}

start() {
checkconfig || return $?
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --exec /usr/sbin/${EXE} -- -c "/etc/${EXE}.conf" -s "${SOCK}"
eend $? "Failed to start BIRD"
}

stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --exec /usr/sbin/${EXE}
eend $? "Failed to stop BIRD"
}

reload() {
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --stop --signal HUP --oknodo --exec /usr/sbin/${EXE}
eend $? "Failed to reload BIRD"
}
61 changes: 61 additions & 0 deletions sls/bird/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# -*- mode: yaml -*-
pkg_bird:
pkg.installed:
- pkgs:
- net-misc/bird: "~>=1.5.0[ipv6]"

/etc/init.d/bird:
file.managed:
- source: salt://bird/bird.initd
- mode: 750
- user: root
- group: root

/etc/init.d/bird6:
file.symlink:
- target: /etc/init.d/bird
- force: True

/etc/bird.conf:
file.managed:
- source: salt://bird/bird.conf
- replace: False
- mode: 640
- user: root
- group: root

/etc/bird6.conf:
file.managed:
- source: salt://bird/bird.conf
- replace: False
- mode: 640
- user: root
- group: root

bird:
service.running:
- enable: True
- watch:
- file: /etc/init.d/bird
- pkg: pkg_bird

bird6:
service.running:
- enable: True
- watch:
- file: /etc/init.d/bird6
- pkg: pkg_bird

bird-reload:
service.running:
- name: bird
- reload: True
- require:
- file: /etc/bird.conf

bird6-reload:
service.running:
- name: bird6
- reload: True
- require:
- file: /etc/bird6.conf
16 changes: 16 additions & 0 deletions sls/cron/cronie.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- mode: yaml -*-
cronie:
pkg.latest:
- name: sys-process/cronie
- use: inotify
service.running:
- sig: cron
- enable: True
- watch:
- pkg: cronie

vixie-cron:
pkg.purged:
- name: sys-process/vixie-cron
service:
- disabled
3 changes: 3 additions & 0 deletions sls/cron/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- mode: yaml -*-
include:
- cron.cronie
4 changes: 4 additions & 0 deletions sls/editors/emacs.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- mode: yaml -*-
emacs:
pkg.installed:
- name: app-editors/emacs
20 changes: 20 additions & 0 deletions sls/fonts/consolefont.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
include:
- augeas.lenses
- fonts.terminus

manage-consolefont:
augeas.change:
- context: /files/etc/conf.d/consolefont
- lens: Shellvars.lns
- require:
- file: augeas-confd
- pkg: terminus
- changes:
- set consolefont '"ter-v14n"'

consolefont_service:
service.running:
- name: consolefont
- enable: True
- watch:
- augeas: manage-consolefont
7 changes: 7 additions & 0 deletions sls/fonts/terminus.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% set terminus_use_flags = salt['pillar.get']('terminus_use_flags',
'-pcf,psf,center-tilde,-ru-g,-a-like-o,distinct-l,ru-dv,ru-i') %}

terminus:
pkg.installed:
- pkgs:
- media-fonts/terminus-font: '[{{ terminus_use_flags }}]'
7 changes: 7 additions & 0 deletions sls/gentoo/init.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- mode: yaml -*-
include:
- gentoo.portage
- gentoo.profile
- gentoo.openrc
- gentoo.makeconf

53 changes: 53 additions & 0 deletions sls/gentoo/makeconf.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- mode: yaml -*-
include:
- augeas.lenses
{% set mirror_host = salt['pillar.get']('gentoo_mirror_host', 'gentoo.bakka.su') %}
{% set arch_conf = salt['pillar.get']('arch_conf', False) %}

{% set num_jobs = grains['num_cpus'] %}
{% set max_la = "%.2f" % (grains['num_cpus'] / 1.5) %}
{% if num_jobs > 8 %}
{% set num_jobs = 8 %}
{% endif %}

manage-make-conf:
augeas.change:
- context: /files/etc/portage/make.conf
# - lens: Makeconf.lns
- changes:
- set PORTDIR '"/usr/portage"'
- set DISTDIR '"/var/tmp/distfiles"'
- set PKGDIR '"/var/tmp/packages"'
- set PORTAGE_SSH_OPTS '""'
- set MAKEOPTS '"-j{{ num_jobs }} --load-average {{ max_la }}"'
- set PYTHON_TARGETS '"python2_7 python3_4"'
- set USE_PYTHON '"2.7 3.4"'
- set USE_SALT '"smp multitarget efi icu sqlite emacs sctp xattr syslog logrotate ssl openssl vhosts symlink device-mapper bash-completion zsh-completion -gnutls -tcpd"'
- set VIDEO_CARDS '""'
- set GENTOO_MIRRORS '"https://{{ mirror_host }}/gentoo-distfiles"'
{% if arch_conf %}
- set CHOST '"{{ arch_conf["CHOST"] }}"'
- set CFLAGS '"{{ arch_conf["CFLAGS"] }}"'
{% if arch_conf.get('CXXFLAGS', False) %}
{% set l_cxxflags = arch_conf['CXXFLAGS'] %}
{% else %}
{% set l_cxxflags = '${CFLAGS}' %}
{% endif %}
- set CXXFLAGS '"{{ l_cxxflags }}"'
# Should I also check for osarch here?
{% if (grains['cpuarch'] == 'x86_64' or grains['cpuarch'] == 'amd64'
or grains['cpuarch'] == 'i686' or grains['cpuarch'] == 'x86') %}
{% if arch_conf.get('CPU_FLAGS', False) %}
- set CPU_FLAGS_X86 '"{{ arch_conf["CPU_FLAGS"] }}"'
{% else %}
- set CPU_FLAGS_X86 '"{% for flag in ("mmx", "mmxext", "sse", "sse2", "sse3", "ssse3", "sse4_1", "sse4_2",
"aes", "popcnt", "avx", "avx2", "fma", "fma3", "fma4", "xop", "3dnow", "3dnowext", "sse4a")
%}{% if flag in grains["cpu_flags"] %}{{ flag }}{% if not loop.last %} {% endif %}{% endif %}{% endfor %}"'
{% endif %}
{% endif %}
{% if arch_conf.get('mirror_arch', False) %}
- set PORTAGE_BINHOST '"https://{{ mirror_host }}/gentoo-packages/{{ arch_conf["mirror_arch"] }}/packages"'
{% endif %}
{% endif %}
- require:
- file: /usr/share/augeas/lenses/makeconf.aug
11 changes: 11 additions & 0 deletions sls/gentoo/openrc.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- mode: yaml -*-
openrc:
pkg.latest:
- name: sys-apps/openrc
cmd.run:
- name: rc
cron.present:
- identifier: rc
- name: "/sbin/rc"
- minute: '*/5'
- user: root
75 changes: 75 additions & 0 deletions sls/gentoo/portage.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# -*- mode: yaml -*-
include:
- core.git

sys-apps/portage:
pkg.latest:
- watch:
- portage_config: sys-apps/portage
portage_config.flags:
- accept_keywords:
- ~ARCH
- use:
- python3
- xattr
- git
- watch_in:
- cmd: emerge-changed-use

app-portage:
pkg.latest:
- pkgs:
- app-portage/portage-utils
- app-portage/gentoolkit
- app-portage/eix
- app-admin/webapp-config

app-portage-purged:
pkg.purged:
- pkgs:
- app-portage/epkg

/etc/portage/postsync.d/q-reinitialize:
file.managed:
- mode: 755
- replace: False

# rewrite this with consideration of read-only portage (on nfs)
/usr/portage:
git.latest:
- name: "git://git.bakka.su/gentoo-mirror"
- target: /usr/portage
- rev: master
- force_clone: True
- force_checkout: True

/etc/portage/repos.conf/:
file.directory:
- mode: 755
- user: root
- group: root
git.latest:
- name: "git://git.bakka.su/server-repos.conf"
- target: /etc/portage/repos.conf
- rev: master
- force_clone: True
- force_checkout: True

emerge-changed-use:
cmd.wait:
- name: '/usr/bin/emerge --quiet --changed-use @world'

# emerge-preserved-rebuild:
# cmd.run:
# - name: '/usr/bin/emerge --quiet @preserved-rebuild'

# glsa-check-fix:
# cmd.run:
# - name: '/usr/bin/glsa-check --fix affected'

/etc/portage/profile/:
file.directory:
- create: True
- mode: 755
- user: root
- group: root
14 changes: 14 additions & 0 deletions sls/gentoo/profile.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- mode: yaml -*-
{% set arch_conf = salt['pillar.get']('arch_conf', False) %}
eselect-profile:
eselect.set:
- name: profile
{% if arch_conf and arch_conf.get('profile', False) %}
- target: '{{ arch_conf["profile"] }}'
{% elif grains['osarch'] == 'x86' %}
- target: hardened/linux/x86
{% elif grains['osarch'] == 'x86_64' %}
- target: hardened/linux/amd64/no-multilib
{% elif grains['osarch'] == 'armv6l' %}
- target: hardened/linux/arm/armv6j
{% endif %}
5 changes: 5 additions & 0 deletions sls/gentoo/repos.conf/baka-bakka.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[baka-bakka]

location = /var/lib/layman/baka-bakka
sync-type = git
sync-uri = git://git.bakka.su/baka-bakka
Loading

0 comments on commit bf63987

Please sign in to comment.