and add _mapdata teststags/v1.0.0
@@ -0,0 +1,13 @@ | |||
# yamllint disable rule:indentation rule:line-length | |||
# {{ grains.get('osfinger', grains.os) }} | |||
--- | |||
{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #} | |||
{{ salt['slsutil.serialize']( | |||
'yaml', | |||
map, | |||
default_flow_style=False, | |||
allow_unicode=True, | |||
) | |||
| regex_replace("^\s+'$", "'", multiline=True) | |||
| trim | |||
}} |
@@ -0,0 +1,18 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=sls | |||
--- | |||
{#- Get the `tplroot` from `tpldir` #} | |||
{%- set tplroot = tpldir.split('/')[0] %} | |||
{%- from tplroot ~ "/map.jinja" import diaspora as mapdata with context %} | |||
{%- do salt['log.debug']('### MAP.JINJA DUMP ###\n' ~ mapdata | yaml(False)) %} | |||
{%- set output_file = '/tmp/salt_mapdata_dump.yaml' %} | |||
{{ tplroot }}-mapdata-dump: | |||
file.managed: | |||
- name: {{ output_file }} | |||
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja | |||
- template: jinja | |||
- context: | |||
map: {{ mapdata | yaml }} |
@@ -21,3 +21,7 @@ diaspora: | |||
username: diaspora | |||
password: ~ | |||
database: diaspora | |||
configuration: | |||
server: | |||
rails_environment: production |
@@ -1,100 +1,44 @@ | |||
{% set os_map = salt['grains.filter_by']({ | |||
'Debian': { | |||
'dependencies' : [ | |||
'build-essential', | |||
'git', | |||
'curl', | |||
'libreadline-dev', | |||
'libcurl4-openssl-dev', | |||
'libidn11-dev', | |||
salt['grains.filter_by']({ | |||
'stretch': 'libssl1.0-dev', | |||
'default': 'libssl-dev' | |||
}, grain='oscodename'), | |||
'libxml2-dev', | |||
'libxslt1-dev', | |||
'imagemagick', | |||
'libmagickwand-dev', | |||
'ghostscript', | |||
'nodejs', | |||
salt['grains.filter_by']({ | |||
'stretch': 'libjemalloc1', | |||
'default': 'libjemalloc2' | |||
}, grain='oscodename'), | |||
], | |||
'postgresql_package': 'libpq-dev', | |||
'mysql_package' : 'default-libmysqlclient-dev', | |||
'redis_package' : 'redis-server', | |||
'redis_service' : 'redis-server', | |||
'configuration' : { | |||
'environment': { | |||
'certificate_authorities': '/etc/ssl/certs/ca-certificates.crt' | |||
} | |||
}, | |||
'libjemalloc': salt['grains.filter_by']({ | |||
'stretch': '/usr/lib/x86_64-linux-gnu/libjemalloc.so.1', | |||
'default': '/usr/lib/x86_64-linux-gnu/libjemalloc.so.2' | |||
}, grain='oscodename'), | |||
}, | |||
'RedHat': { | |||
'dependencies' : [ | |||
'tar', | |||
'make', | |||
'automake', | |||
'gcc', | |||
'gcc-c++', | |||
'git', | |||
'net-tools', | |||
'libcurl-devel', | |||
'libxml2-devel', | |||
'libffi-devel', | |||
'libxslt-devel', | |||
'wget', | |||
'ImageMagick', | |||
'nodejs', | |||
], | |||
'postgresql_package': 'postgresql-devel', | |||
'mysql_package' : 'mariadb-devel', | |||
'redis_package' : 'redis', | |||
'redis_service' : 'redis', | |||
'configuration' : { | |||
'environment': { | |||
'certificate_authorities': '/etc/pki/tls/certs/ca-bundle.crt' | |||
} | |||
}, | |||
'libjemalloc': '/usr/lib/x86_64-linux-gnu/libjemalloc.so.1', | |||
}, | |||
}, merge=salt['grains.filter_by']({ | |||
'Ubuntu': { | |||
'dependencies' : [ | |||
'build-essential', | |||
'git', | |||
'curl', | |||
'libcurl4-openssl-dev', | |||
'libssl-dev', | |||
'libxml2-dev', | |||
'libxslt1-dev', | |||
'libgmp-dev', | |||
'imagemagick', | |||
'libmagickwand-dev', | |||
'nodejs', | |||
salt['grains.filter_by']({ | |||
'bionic': 'libjemalloc1', | |||
'default': 'libjemalloc2' | |||
}, grain='oscodename'), | |||
], | |||
'libjemalloc': salt['grains.filter_by']({ | |||
'bionic': '/usr/lib/x86_64-linux-gnu/libjemalloc.so.1', | |||
'default': '/usr/lib/x86_64-linux-gnu/libjemalloc.so.2' | |||
}, grain='oscodename'), | |||
}, | |||
}, grain='os', merge=salt['pillar.get']('diaspora:lookup'))) %} | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=jinja | |||
{% import_yaml "diaspora/defaults.yaml" as defaults %} | |||
{#- Get the `tplroot` from `tpldir` #} | |||
{%- set tplroot = tpldir.split('/')[0] %} | |||
{#- Start imports as #} | |||
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %} | |||
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %} | |||
{%- import_yaml tplroot ~ "/osmap.yaml" as osmap %} | |||
{%- import_yaml tplroot ~ "/osfingermap.yaml" as osfingermap %} | |||
{% do defaults.diaspora.update(os_map) %} | |||
{#- Retrieve the config dict only once #} | |||
{%- set _config = salt['config.get'](tplroot, default={}) %} | |||
# use production as default rails environment | |||
{% do defaults.diaspora.configuration.update({'server': {'rails_environment': 'production'}}) %} | |||
{%- set defaults = salt['grains.filter_by']( | |||
default_settings, | |||
default=tplroot, | |||
merge=salt['grains.filter_by']( | |||
osfamilymap, | |||
grain='os_family', | |||
merge=salt['grains.filter_by']( | |||
osmap, | |||
grain='os', | |||
merge=salt['grains.filter_by']( | |||
osfingermap, | |||
grain='osfinger', | |||
merge=salt['grains.filter_by']( | |||
_config, | |||
default='lookup' | |||
) | |||
) | |||
) | |||
) | |||
) | |||
%} | |||
{% set diaspora = salt['pillar.get']('diaspora', default=defaults.diaspora, merge=True) %} | |||
{%- set config = salt['grains.filter_by']( | |||
{'defaults': defaults}, | |||
default='defaults', | |||
merge=_config | |||
) | |||
%} | |||
{%- set diaspora = config %} |
@@ -0,0 +1,62 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=yaml | |||
# | |||
# Setup variables using grains['os_family'] based logic. | |||
# You just need to add the key:values for an `os_family` that differ | |||
# from `defaults.yaml` + `osarch.yaml`. | |||
# Only add an `os_family` which is/will be supported by the formula. | |||
# | |||
# If you do not need to provide defaults via the `os_family` grain, | |||
# you will need to provide at least an empty dict in this file, e.g. | |||
# osfamilymap: {} | |||
--- | |||
Debian: | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libreadline-dev | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- ghostscript | |||
- nodejs | |||
- libjemalloc2 | |||
postgresql_package: libpq-dev | |||
mysql_package: default-libmysqlclient-dev | |||
redis_package: redis-server | |||
redis_service: redis-server | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/ssl/certs/ca-certificates.crt | |||
libjemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 | |||
RedHat: | |||
dependencies: | |||
- tar | |||
- make | |||
- automake | |||
- gcc | |||
- gcc-c++ | |||
- git | |||
- net-tools | |||
- libcurl-devel | |||
- libxml2-devel | |||
- libffi-devel | |||
- libxslt-devel | |||
- wget | |||
- ImageMagick | |||
- nodejs | |||
- jemalloc | |||
postgresql_package: postgresql-devel | |||
mysql_package: mariadb-devel | |||
redis_package: redis | |||
redis_service: redis | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/pki/tls/certs/ca-bundle.crt | |||
libjemalloc: /usr/lib64/libjemalloc.so.2 |
@@ -0,0 +1,55 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=yaml | |||
# | |||
# Setup variables using grains['osfinger'] based logic. | |||
# You just need to add the key:values for an `osfinger` that differ | |||
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml` + `osmap.yaml`. | |||
# Only add an `osfinger` which is/will be supported by the formula. | |||
# | |||
# If you do not need to provide defaults via the `os_finger` grain, | |||
# you will need to provide at least an empty dict in this file, e.g. | |||
# osfingermap: {} | |||
--- | |||
# os: Debian | |||
Debian-10: {} | |||
Debian-9: | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libreadline-dev | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl1.0-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- ghostscript | |||
- nodejs | |||
- libjemalloc1 | |||
libjemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so.1 | |||
# os: Ubuntu | |||
Ubuntu-20.04: {} | |||
Ubuntu-18.04: | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- libgmp-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- nodejs | |||
- libjemalloc1 | |||
libjemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so.1 | |||
# os: CentOS | |||
CentOS Linux-8: {} | |||
CentOS Linux-7: | |||
libjemalloc: /usr/lib64/libjemalloc.so.1 |
@@ -0,0 +1,31 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=yaml | |||
# | |||
# Setup variables using grains['os'] based logic. | |||
# You just need to add the key:values for an `os` that differ | |||
# from `defaults.yaml` + `osarch.yaml` + `os_family.yaml`. | |||
# Only add an `os` which is/will be supported by the formula. | |||
# | |||
# If you do not need to provide defaults via the `os` grain, | |||
# you will need to provide at least an empty dict in this file, e.g. | |||
# osmap: {} | |||
--- | |||
# os_family: Debian | |||
Ubuntu: | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- libgmp-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- nodejs | |||
- libjemalloc2 | |||
# os_family: RedHat | |||
CentOS: {} |
@@ -192,6 +192,7 @@ suites: | |||
state_top: | |||
base: | |||
'*': | |||
- diaspora._mapdata | |||
- diaspora | |||
pillars: | |||
top.sls: | |||
@@ -204,4 +205,5 @@ suites: | |||
tests.sls: test/salt/pillar/tests.sls | |||
verifier: | |||
inspec_tests: | |||
- path: test/integration/_mapdata | |||
- path: test/integration/default |
@@ -0,0 +1,50 @@ | |||
# InSpec Profile: `default` | |||
This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). | |||
## Verify a profile | |||
InSpec ships with built-in features to verify a profile structure. | |||
```bash | |||
$ inspec check default | |||
Summary | |||
------- | |||
Location: default | |||
Profile: profile | |||
Controls: 4 | |||
Timestamp: 2019-06-24T23:09:01+00:00 | |||
Valid: true | |||
Errors | |||
------ | |||
Warnings | |||
-------- | |||
``` | |||
## Execute a profile | |||
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. | |||
```bash | |||
$ inspec exec default | |||
.. | |||
Finished in 0.0025 seconds (files took 0.12449 seconds to load) | |||
8 examples, 0 failures | |||
``` | |||
## Execute a specific control from a profile | |||
To run one control from the profile use `inspec exec /path/to/profile --controls name`. | |||
```bash | |||
$ inspec exec default --controls package | |||
. | |||
Finished in 0.0025 seconds (files took 0.12449 seconds to load) | |||
1 examples, 0 failures | |||
``` | |||
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). |
@@ -0,0 +1,16 @@ | |||
# frozen_string_literal: true | |||
# Keep only first 2 digits from Ubuntu finger | |||
mapdata_file = "_mapdata/#{system.platform[:finger].split('.').first}.yaml" | |||
# Load the mapdata from profile https://docs.chef.io/inspec/profiles/#profile-files | |||
mapdata_dump = inspec.profile.file(mapdata_file) | |||
control '`map.jinja` YAML dump' do | |||
title 'should contain the lines' | |||
describe file('/tmp/salt_mapdata_dump.yaml') do | |||
it { should exist } | |||
its('content') { should eq mapdata_dump } | |||
end | |||
end |
@@ -0,0 +1,48 @@ | |||
# yamllint disable rule:indentation rule:line-length | |||
# CentOS Linux-7 | |||
--- | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/pki/tls/certs/ca-bundle.crt | |||
url: https://example.org/ | |||
server: | |||
rails_environment: production | |||
settings: | |||
pod_name: example diaspora* pod | |||
database: | |||
database: diaspora | |||
host: localhost | |||
password: secret | |||
type: postgresql | |||
username: diaspora | |||
dependencies: | |||
- tar | |||
- make | |||
- automake | |||
- gcc | |||
- gcc-c++ | |||
- git | |||
- net-tools | |||
- libcurl-devel | |||
- libxml2-devel | |||
- libffi-devel | |||
- libxslt-devel | |||
- wget | |||
- ImageMagick | |||
- nodejs | |||
- jemalloc | |||
install_path: /srv/diaspora | |||
install_redis: true | |||
libjemalloc: /usr/lib64/libjemalloc.so.1 | |||
mysql_package: mariadb-devel | |||
postgresql_package: postgresql-devel | |||
redis_package: redis | |||
redis_service: redis | |||
repository: https://github.com/diaspora/diaspora.git | |||
ruby_version: 2.6.6 | |||
systemd: | |||
web_template: salt://diaspora/files/diaspora-web.service | |||
user: | |||
shell: /bin/bash | |||
username: diaspora | |||
version: develop |
@@ -0,0 +1,48 @@ | |||
# yamllint disable rule:indentation rule:line-length | |||
# CentOS Linux-8 | |||
--- | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/pki/tls/certs/ca-bundle.crt | |||
url: https://example.org/ | |||
server: | |||
rails_environment: production | |||
settings: | |||
pod_name: example diaspora* pod | |||
database: | |||
database: diaspora | |||
host: localhost | |||
password: secret | |||
type: postgresql | |||
username: diaspora | |||
dependencies: | |||
- tar | |||
- make | |||
- automake | |||
- gcc | |||
- gcc-c++ | |||
- git | |||
- net-tools | |||
- libcurl-devel | |||
- libxml2-devel | |||
- libffi-devel | |||
- libxslt-devel | |||
- wget | |||
- ImageMagick | |||
- nodejs | |||
- jemalloc | |||
install_path: /srv/diaspora | |||
install_redis: true | |||
libjemalloc: /usr/lib64/libjemalloc.so.2 | |||
mysql_package: mariadb-devel | |||
postgresql_package: postgresql-devel | |||
redis_package: redis | |||
redis_service: redis | |||
repository: https://github.com/diaspora/diaspora.git | |||
ruby_version: 2.6.6 | |||
systemd: | |||
web_template: salt://diaspora/files/diaspora-web.service | |||
user: | |||
shell: /bin/bash | |||
username: diaspora | |||
version: develop |
@@ -0,0 +1,47 @@ | |||
# yamllint disable rule:indentation rule:line-length | |||
# Debian-10 | |||
--- | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/ssl/certs/ca-certificates.crt | |||
url: https://example.org/ | |||
server: | |||
rails_environment: production | |||
settings: | |||
pod_name: example diaspora* pod | |||
database: | |||
database: diaspora | |||
host: localhost | |||
password: secret | |||
type: postgresql | |||
username: diaspora | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libreadline-dev | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- ghostscript | |||
- nodejs | |||
- libjemalloc2 | |||
install_path: /srv/diaspora | |||
install_redis: true | |||
libjemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 | |||
mysql_package: default-libmysqlclient-dev | |||
postgresql_package: libpq-dev | |||
redis_package: redis-server | |||
redis_service: redis-server | |||
repository: https://github.com/diaspora/diaspora.git | |||
ruby_version: 2.6.6 | |||
systemd: | |||
web_template: salt://diaspora/files/diaspora-web.service | |||
user: | |||
shell: /bin/bash | |||
username: diaspora | |||
version: develop |
@@ -0,0 +1,47 @@ | |||
# yamllint disable rule:indentation rule:line-length | |||
# Debian-9 | |||
--- | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/ssl/certs/ca-certificates.crt | |||
url: https://example.org/ | |||
server: | |||
rails_environment: production | |||
settings: | |||
pod_name: example diaspora* pod | |||
database: | |||
database: diaspora | |||
host: localhost | |||
password: secret | |||
type: postgresql | |||
username: diaspora | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libreadline-dev | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl1.0-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- ghostscript | |||
- nodejs | |||
- libjemalloc1 | |||
install_path: /srv/diaspora | |||
install_redis: true | |||
libjemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so.1 | |||
mysql_package: default-libmysqlclient-dev | |||
postgresql_package: libpq-dev | |||
redis_package: redis-server | |||
redis_service: redis-server | |||
repository: https://github.com/diaspora/diaspora.git | |||
ruby_version: 2.6.6 | |||
systemd: | |||
web_template: salt://diaspora/files/diaspora-web.service | |||
user: | |||
shell: /bin/bash | |||
username: diaspora | |||
version: develop |
@@ -0,0 +1,46 @@ | |||
# yamllint disable rule:indentation rule:line-length | |||
# Ubuntu-18.04 | |||
--- | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/ssl/certs/ca-certificates.crt | |||
url: https://example.org/ | |||
server: | |||
rails_environment: production | |||
settings: | |||
pod_name: example diaspora* pod | |||
database: | |||
database: diaspora | |||
host: localhost | |||
password: secret | |||
type: postgresql | |||
username: diaspora | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- libgmp-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- nodejs | |||
- libjemalloc1 | |||
install_path: /srv/diaspora | |||
install_redis: true | |||
libjemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so.1 | |||
mysql_package: default-libmysqlclient-dev | |||
postgresql_package: libpq-dev | |||
redis_package: redis-server | |||
redis_service: redis-server | |||
repository: https://github.com/diaspora/diaspora.git | |||
ruby_version: 2.6.6 | |||
systemd: | |||
web_template: salt://diaspora/files/diaspora-web.service | |||
user: | |||
shell: /bin/bash | |||
username: diaspora | |||
version: develop |
@@ -0,0 +1,46 @@ | |||
# yamllint disable rule:indentation rule:line-length | |||
# Ubuntu-20.04 | |||
--- | |||
configuration: | |||
environment: | |||
certificate_authorities: /etc/ssl/certs/ca-certificates.crt | |||
url: https://example.org/ | |||
server: | |||
rails_environment: production | |||
settings: | |||
pod_name: example diaspora* pod | |||
database: | |||
database: diaspora | |||
host: localhost | |||
password: secret | |||
type: postgresql | |||
username: diaspora | |||
dependencies: | |||
- build-essential | |||
- git | |||
- curl | |||
- libcurl4-openssl-dev | |||
- libidn11-dev | |||
- libssl-dev | |||
- libxml2-dev | |||
- libxslt1-dev | |||
- libgmp-dev | |||
- imagemagick | |||
- libmagickwand-dev | |||
- nodejs | |||
- libjemalloc2 | |||
install_path: /srv/diaspora | |||
install_redis: true | |||
libjemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc.so.2 | |||
mysql_package: default-libmysqlclient-dev | |||
postgresql_package: libpq-dev | |||
redis_package: redis-server | |||
redis_service: redis-server | |||
repository: https://github.com/diaspora/diaspora.git | |||
ruby_version: 2.6.6 | |||
systemd: | |||
web_template: salt://diaspora/files/diaspora-web.service | |||
user: | |||
shell: /bin/bash | |||
username: diaspora | |||
version: develop |
@@ -0,0 +1,15 @@ | |||
# -*- coding: utf-8 -*- | |||
# vim: ft=yaml | |||
--- | |||
name: _mapdata | |||
title: diaspora formula | |||
maintainer: SaltStack Formulas | |||
license: Apache-2.0 | |||
summary: Verify the diaspora formula _mapdata dumps | |||
depends: | |||
- name: share | |||
path: test/integration/share | |||
supports: | |||
- platform-name: debian | |||
- platform-name: ubuntu | |||
- platform-name: centos |