Skip to content

Commit

Permalink
add ci and modify molecule.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi8080 committed Jul 30, 2024
1 parent 2771359 commit 1103402
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 7 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

---
name: CI

on: # yamllint disable-line rule:truthy
push:
branches:
- master
pull_request:
branches:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch: ~

jobs:
molecule:
runs-on: ubuntu-latest
strategy:
matrix:
distro:
# - image: jrei/systemd-ubuntu:16.04
# instance: systemd-ubuntu-16.04
# - image: jrei/systemd-ubuntu:18.04
# instance: systemd-ubuntu-18.04
- image: ubuntu2004
instance: docker-ubuntu2004-ansible
# - image: jrei/systemd-centos:7
# instance: systemd-centos-7
# - image: jrei/systemd-centos:8
# instance: systemd-centos-8
# - image: jrei/systemd-debian:9
# instance: systemd-debian-9
# - image: jrei/systemd-debian:10
# instance: systemd-debian-10
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/[email protected]
with:
python-version: '3.12'

- name: Install molecule
run: pip3 install ansible molecule molecule-docker


- name: Run molecule
run: molecule test
env:
MOLECULE_DISTRO: ${{ matrix.distro.image }}
MOLECULE_INSTANCE_NAME: ${{ matrix.distro.instance }}
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ galaxy_info:
description: This ansible role is used to install Elasticsearch Server with docker on linux.
company: "KTH"
license: "license (BSD, MIT)"
role_name: docker-elasticsearch
role_name: docker_elasticsearch
namespace: abhi8080
min_ansible_version: 2.8
platforms:
Expand Down
33 changes: 33 additions & 0 deletions molecule/default/ansible-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---

# .ansible-lint
exclude_paths:
- .cache/
- .molecule/

# Enable checking of loop variable prefixes in roles
loop_var_prefix: "_elasticsearch__"

use_default_rules: true

skip_list:
- no-handler
- yaml # I will manually run yamllint

# Any rule that has the 'opt-in' tag will not be loaded unless its 'id' is
# mentioned in the enable_list:
enable_list:
- no-same-owner

# Offline mode disables installation of requirements.yml
offline: false

# List of additional kind:pattern to be added at the top of the default
# match list, first match determines the file kind.
kinds:
# - playbook: "**/examples/*.{yml,yaml}"
# - galaxy: "**/folder/galaxy.yml"
# - tasks: "**/tasks/*.yml"
# - vars: "**/vars/*.yml"
# - meta: "**/meta/main.yml"
- yaml: "**/*.yaml-too"
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- name: Converge
hosts: all
roles:
- abhi8080.docker-elasticsearch
- abhi8080.docker_elasticsearch
vars_files:
- converge-vars.yml
23 changes: 18 additions & 5 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
---
role_name_check: 1

dependency:
name: galaxy
options:
ignore-errors: true
driver:
name: docker
lint: |
set -e
yamllint --config-file molecule/default/yamllint.yml .
ansible-lint -c molecule/default/ansible-lint.yml .
flake8
platforms:
- name: instance
- name: "${MOLECULE_INSTANCE_NAME:-docker-ubuntu2004-ansible}"
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
published_ports:
- '9200:9200/tcp'
command: ${MOLECULE_DOCKER_COMMAND:-""}
privileged: true
pre_build_image: true
provisioner:
name: ansible
options:
vvv: true
env:
IN_MOLECULE: 'true'
scenario:
name: default
verifier:
name: ansible
55 changes: 55 additions & 0 deletions molecule/default/yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---

rules:
braces:
min-spaces-inside: 1
max-spaces-inside: 1
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
brackets:
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: 0
max-spaces-inside-empty: 0
colons:
max-spaces-before: 0
max-spaces-after: 1
commas:
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments:
require-starting-space: true
min-spaces-from-content: 2
comments-indentation: enable
document-end: disable
document-start:
present: true
empty-lines:
max: 2
max-start: 0
max-end: 1
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
hyphens:
max-spaces-after: 1
indentation:
spaces: 2
indent-sequences: true
check-multi-line-strings: false
key-duplicates: enable
key-ordering: disable
line-length:
max: 8000
allow-non-breakable-words: true
allow-non-breakable-inline-mappings: false
new-line-at-end-of-file: enable
new-lines:
type: unix
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: false
trailing-spaces: enable
truthy:
level: warning

0 comments on commit 1103402

Please sign in to comment.