initial commit

This commit is contained in:
Eric Renfro 2019-01-22 22:35:58 -05:00
commit d691f0d1a5
Signed by: psi-jack
GPG Key ID: 14977F3A50D9A5BF
10 changed files with 177 additions and 0 deletions

60
.kitchen.yml Normal file
View File

@ -0,0 +1,60 @@
---
driver:
name: docker
use_sudo: false
privileged: true
require_chef_omnibus: false
verifier:
name: inspec
inspec_tests:
- test/integration/cli53/inspec
platforms:
- name: ubuntu-14.04
driver_config:
disable_upstart: false
image: ubuntu-upstart:14.04
run_command: /sbin/init
- name: debian-9.4
driver_config:
run_command: /bin/systemd
- name: ubuntu-16.04
driver_config:
run_command: /sbin/init
- name: centos-7
driver_config:
run_command: /usr/lib/systemd/systemd
provisioner:
name: salt_solo
#log_level: quiet
require_chef: false
formula: cli53
state_top:
base:
'*':
- cli53
pillars-from-files:
base.sls: pillar.example
pillars:
top.sls:
base:
'*':
- base
- cli53
cli53.sls:
cli53:
register: []
scripts: []
suites:
- name: cli53-client
provisioner:
pillars:
cli53.sls:
cli53:
version: 0.8.13

16
.travis.yml Normal file
View File

@ -0,0 +1,16 @@
sudo: required
language: python
services:
- docker
before_install:
- bundle install
env:
matrix:
- INSTANCE: cli53-ubuntu-1404
- INSTANCE: cli53-ubuntu-1604
- INSTANCE: cli53-centos-7
script:
- bundle exec kitchen verify ${INSTANCE}

6
Gemfile Normal file
View File

@ -0,0 +1,6 @@
source "https://rubygems.org"
gem "test-kitchen"
gem "kitchen-docker"
gem "kitchen-salt"
gem "kitchen-inspec"

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
Copyright (c) 2013-2015 Salt Stack Formulas
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

21
README.rst Normal file
View File

@ -0,0 +1,21 @@
======
cli53
======
.. note::
See the full `Salt Formulas installation and usage instructions
<http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.
Available states
================
.. contents::
:local:
``cli53``
------------
Downloads and installs the cli53 binary.
.. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=4 sw=4 et

3
cli53/defaults.yaml Normal file
View File

@ -0,0 +1,3 @@
cli53:
version: 0.8.13

24
cli53/init.sls Normal file
View File

@ -0,0 +1,24 @@
{%- from slspath + '/map.jinja' import cli53 with context -%}
cli53-bin-dir:
file.directory:
- name: /usr/local/bin
- makedirs: True
# Install cli53
cli53-download:
file.managed:
- name: /usr/local/bin/cli53-linux-{{ cli53.arch }}
- source: https://github.com/barnybug/cli53/releases/download/{{ cli53.version }}/cli53-linux-{{ cli53.arch }}
- source_hash: https://github.com/barnybug/cli53/releases/download/{{ cli53.version }}/cli53_{{ cli53.version }}_checksums.txt
- require:
- file: cli53-bin-dir
# Link cli53
cli53-link:
file.symlink:
- target: cli53
- name: /usr/local/bin/cli53-linux-{{ cli53.arch }}
- watch:
- file: cli53-download

21
cli53/map.jinja Normal file
View File

@ -0,0 +1,21 @@
{% import_yaml slspath+"/defaults.yaml" as defaults %}
{% set cli53 = salt['pillar.get']('cli53', default=defaults.cli53, merge=True) %}
{## Add any overrides based on CPU architecture. ##}
{% set cli53 = salt['grains.filter_by']({
'armv6l': {
"arch": 'arm'
},
'armv7l': {
"arch": 'arm'
},
'x86_64': {
"arch": 'amd64'
}
}
,grain="cpuarch"
,merge=cli53)
%}
{% do cli53.config.update({'retry_join': cli53.config.retry_join or []}) %}

5
pillar.example Normal file
View File

@ -0,0 +1,5 @@
cli53:
# Start Consul agent service and enable it at boot time
version: 0.8.13
# vim: ft=yaml

View File

@ -0,0 +1,8 @@
describe file('/usr/local/bin/cli53-linux-amd64') do
it { should exist }
end
describe file('/usr/local/bin/cli53') do
it { should be_symlink }
its('link_path') { should eq 'cli53-linux-amd64' }
end