mirror of
https://github.com/jbowdre/vagrant-saltlab.git
synced 2024-12-24 01:22:18 +00:00
fun with pillars
- map distros to package names - create users on saltlab minions - ditch cowsay - replace nginx with apache (and pull pkg name from pillar data)
This commit is contained in:
parent
6ac3b8ad19
commit
2fb3b6e340
13 changed files with 40 additions and 27 deletions
11
srv/pillar/pkg/init.sls
Normal file
11
srv/pillar/pkg/init.sls
Normal file
|
@ -0,0 +1,11 @@
|
|||
pkgs:
|
||||
{% if grains['os_family'] == 'RedHat' %}
|
||||
apache: httpd
|
||||
vim: vim-enhanced
|
||||
{% elif grains['os_family'] == 'Debian' %}
|
||||
apache: apache2
|
||||
vim: vim
|
||||
{% else %}
|
||||
apache: apache
|
||||
vim: vim
|
||||
{% endif %}
|
4
srv/pillar/top.sls
Normal file
4
srv/pillar/top.sls
Normal file
|
@ -0,0 +1,4 @@
|
|||
base:
|
||||
'*':
|
||||
- users
|
||||
- pkg
|
6
srv/pillar/users/init.sls
Normal file
6
srv/pillar/users/init.sls
Normal file
|
@ -0,0 +1,6 @@
|
|||
users:
|
||||
jake: 1001
|
||||
jason: 1002
|
||||
john: 1003
|
||||
jon: 1004
|
||||
jordan: 1005
|
7
srv/salt/apache/init.sls
Normal file
7
srv/salt/apache/init.sls
Normal file
|
@ -0,0 +1,7 @@
|
|||
install_apache:
|
||||
pkg.installed:
|
||||
- name: {{ pillar['pkgs']['apache'] }}
|
||||
service.running:
|
||||
- require:
|
||||
- pkg: {{ pillar['pkgs']['apache'] }}
|
||||
- name: {{ pillar['pkgs']['apache'] }}
|
3
srv/salt/apache/uninstall.sls
Normal file
3
srv/salt/apache/uninstall.sls
Normal file
|
@ -0,0 +1,3 @@
|
|||
uninstall_apache:
|
||||
pkg.removed:
|
||||
- name: {{ pillar['pkgs']['apache'] }}
|
|
@ -1,3 +0,0 @@
|
|||
install_cowsay:
|
||||
pkg.installed:
|
||||
- name: cowsay
|
|
@ -1,3 +0,0 @@
|
|||
uninstall_cowsay:
|
||||
pkg.removed:
|
||||
- name: cowsay
|
|
@ -1,6 +0,0 @@
|
|||
nginx:
|
||||
pkg.installed: []
|
||||
service.running:
|
||||
- require:
|
||||
- pkg: nginx
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
nginx:
|
||||
pkg.removed
|
||||
|
|
@ -3,7 +3,7 @@ base:
|
|||
- vim
|
||||
'roles:saltlab':
|
||||
- match: grain
|
||||
- cowsay
|
||||
- users
|
||||
'roles:web':
|
||||
- match: grain
|
||||
- nginx
|
||||
- apache
|
||||
|
|
5
srv/salt/users/init.sls
Normal file
5
srv/salt/users/init.sls
Normal file
|
@ -0,0 +1,5 @@
|
|||
{% for user, uid in pillar.get('users', {}).items() %}
|
||||
{{user}}:
|
||||
user.present:
|
||||
- uid: {{uid}}
|
||||
{% endfor %}
|
|
@ -1,10 +1,6 @@
|
|||
install_vim:
|
||||
pkg.installed:
|
||||
{% if grains['os_family'] == 'RedHat'%}
|
||||
- name: vim-enhanced
|
||||
{% else %}
|
||||
- name: vim
|
||||
{% endif %}
|
||||
- name: {{ pillar['pkgs']['vim'] }}
|
||||
|
||||
/etc/vimrc:
|
||||
file.managed:
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
uninstall_vim:
|
||||
pkg.removed:
|
||||
{% if grains['os_family'] == 'RedHat'%}
|
||||
- name: vim-enhanced
|
||||
{% else %}
|
||||
- name: vim
|
||||
{% endif %}
|
||||
- name: {{ pillar['pkgs']['vim'] }}
|
||||
|
||||
/etc/vimrc:
|
||||
file.absent
|
||||
|
|
Loading…
Reference in a new issue