Skip to content

Commit

Permalink
[upd] adds linting rules and molecule tests
Browse files Browse the repository at this point in the history
- with travis
  • Loading branch information
Carrol Cox committed Jul 28, 2020
1 parent 56e3059 commit c9b25c2
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "3.8"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python3-pip

install:
# Install ansible
- pip3 install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
33 changes: 33 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# Based on ansible-lint config
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation: disable
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
24 changes: 24 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
galaxy_info:
author: carrol@protonmail.com
description: Install, setup and run pganalyze-collector for PostgreSQL as systemd service for VM and BareMetal servers.
license: MIT License
min_ansible_version: 2.9

platforms:
- name: Ubuntu
versions:
- 16.04
- 18.04
- 20.04
- name: Debian
versions:
- 8
- 9
- 10

galaxy_tags:
- postgresql
- pganalyze
- pganalyze-collector

dependencies: []
22 changes: 22 additions & 0 deletions molecule/default/INSTALL.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*******
Docker driver installation guide
*******

Requirements
============

* Docker Engine

Install
=======

Please refer to the `Virtual environment`_ documentation for installation best
practices. If not using a virtual environment, please consider passing the
widely recommended `'--user' flag`_ when invoking ``pip``.

.. _Virtual environment: https://virtualenv.pypa.io/en/latest/
.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site

.. code-block:: bash
$ python3 -m pip install 'molecule[docker]'
7 changes: 7 additions & 0 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include ansible-pganalyze-collector"
include_role:
name: "ansible-pganalyze-collector"
13 changes: 13 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
dependency:
name: galaxy
driver:
name: docker
platforms:
- name: instance
image: ubuntu
pre_build_image: true
provisioner:
name: ansible
verifier:
name: ansible
9 changes: 9 additions & 0 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# This is an example playbook to execute Ansible tests.

- name: Verify
hosts: all
tasks:
- name: Example assertion
assert:
that: true
2 changes: 2 additions & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- ansible-pganalyze-collector

0 comments on commit c9b25c2

Please sign in to comment.