Skip to content

Commit

Permalink
fix: temporary remove molecule tests the time to fix them
Browse files Browse the repository at this point in the history
  • Loading branch information
lotusnoir committed Dec 10, 2021
1 parent fd58919 commit 4d46436
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 183 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
templates/router.db
templates/config
*.swp
74 changes: 74 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
stages:
- checks
- changes
- push

variables:
GITHUB_USER: lotusnoir


##################################################
# SYNTAX CHECKS
##################################################
yamllint:
stage: checks
image: sdesbure/yamllint
before_script:
- yamllint --version
script:
- yamllint .

ansible-lint:
stage: checks
image: lotusnoir/ansible_play
script:
- ansible-lint .


######################################################
# GENERATE CHANGELOG FILE
######################################################
changelog:
stage: changes
image: node:latest
needs:
- yamllint
- ansible-lint
artifacts:
paths:
- CHANGELOG.md
expire_in: 1 day
before_script:
- npm install -g auto-changelog
script:
- auto-changelog -t keepachangelog --sort-commits date-desc --hide-empty-releases --hide-credit -l 10 -b 10


##################################################
# PUSH CODE WHEN ALL TEST OK
##################################################
push_src_on_github:
stage: push
image: alpine:latest
needs:
- changelog
before_script:
- apk add git openssh-client
- eval $(ssh-agent -s)
- echo "${GITHUB_USER_PRIVATE_KEY}" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tUser ansible\n\tStrictHostKeyChecking no\n\tForwardAgent yes\n\n" > ~/.ssh/config
- git config --global user.email "${GITHUB_USER_EMAIL}"
- git config --global user.name "${GITHUB_USER}"
- git config --global init.defaultBranch main
- COMMENT=$(git log -1 --pretty=%B | head -1)
script:
- git clone [email protected]:${GITHUB_USER}/ansible-apps_oxidized.git /tmp/ansible-apps_oxidized
- rm -rf .git
- cp -r . /tmp/ansible-apps_oxidized/
- cd /tmp/ansible-apps_oxidized
- git add -A
- git commit -m "${COMMENT}" || echo "No changes, nothing to commit!"
- git push --follow-tags
81 changes: 0 additions & 81 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -29,84 +29,3 @@ rules:
trailing-spaces: enable
truthy:
level: warning


#rules:
# braces:
# # Keeping 0 min-spaces to not error on empty collection definitions
# min-spaces-inside: 0
# # Allowing one space inside braces to improve code readability
# max-spaces-inside: 1
#
# brackets:
# # Keeping 0 min-spaces to not error on empty collection definitions
# min-spaces-inside: 0
# # Allowing one space inside braces to improve code readability
# max-spaces-inside: 1
#
# colons:
# level: warning
# max-spaces-before: 0
# # Allow to tab all vars on the same column
# max-spaces-after: -1
#
# commas:
# max-spaces-before: 0
# min-spaces-after: 1
# max-spaces-after: 1
#
# comments:
# # Disabling to allow for code comment blocks and #!/usr/bin/ansible-playbook
# require-starting-space: false
# ignore-shebangs: true
# min-spaces-from-content: 2
#
# comments-indentation: enable
#
# document-start:
# present: true
#
# empty-lines:
# max: 2
# max-start: 0
# max-end: 0
#
# empty-values:
# forbid-in-block-mappings: true
# forbid-in-flow-mappings: true
#
# hyphens:
# max-spaces-after: 1
#
# indentation:
# # Requiring 2 space indentation
# spaces: 2
# # Requiring consistent indentation within a file, either indented or not
# indent-sequences: consistent
# check-multi-line-strings: false
#
# key-duplicates: enable
#
# # Disabling due to copious amounts of long lines in the code which would
# line-length: disable
#
# new-line-at-end-of-file: enable
#
# new-lines:
# type: unix
#
# octal-values:
# forbid-implicit-octal: false
# forbid-explicit-octal: true
#
# quoted-strings:
# level: warning
# quote-type: any
# required: false
# extra-required: []
# extra-allowed: []
#
# trailing-spaces: enable
#
# # Disabling due to copious amounts of truthy warnings in the code which would
# truthy: disable
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
57 changes: 18 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,36 @@
# Ansible Role: ansible-apps_oxidized
# ansible-apps_oxidized

## Description

[![Build Status](https://travis-ci.com/lotusnoir/ansible-apps_oxidized.svg?branch=master?style=flat)](https://travis-ci.com/lotusnoir/ansible-apps_oxidized)
[![License](https://img.shields.io/badge/license-Apache--2.0-brightgreen?style=flat)](https://opensource.org/licenses/Apache-2.0)
[![Ansible Role](https://img.shields.io/badge/galaxy-apps_oxidized-purple?style=flat)](https://galaxy.ansible.com/lotusnoir/apps_oxidized)
[![Galaxy Role](https://img.shields.io/badge/galaxy-apps_oxidized-purple?style=flat)](https://galaxy.ansible.com/lotusnoir/apps_oxidized)
[![Version](https://img.shields.io/github/release/lotusnoir/ansible-apps_oxidized.svg)](https://github.com/lotusnoir/ansible-apps_oxidized/releases/latest)
![GitHub repo size](https://img.shields.io/github/repo-size/lotusnoir/ansible-apps_oxidized?color=orange&style=flat)
![Ansible Quality Score](https://img.shields.io/ansible/quality/52300)
[![downloads](https://img.shields.io/ansible/role/d/52300)](https://galaxy.ansible.com/lotusnoir/apps_oxidized)
[![Version](https://img.shields.io/github/release/lotusnoir/ansible-apps_oxidized.svg)](https://github.com/lotusnoir/ansible-apps_oxidized/releases/)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=lotusnoir_ansible-apps_oxidized&metric=alert_status)](https://sonarcloud.io/dashboard?id=lotusnoir_ansible-apps_oxidized)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=lotusnoir_ansible-apps_oxidized&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=lotusnoir_ansible-apps_oxidized)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=lotusnoir_ansible-apps_oxidized&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=lotusnoir_ansible-apps_oxidized)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=lotusnoir_ansible-apps_oxidized&metric=security_rating)](https://sonarcloud.io/dashboard?id=lotusnoir_ansible-apps_oxidized)
![Ansible Quality Score](https://img.shields.io/ansible/quality/52300)
[![License](https://img.shields.io/badge/license-Apache--2.0-brightgreen?style=flat)](https://opensource.org/licenses/Apache-2.0)

Deploy [oxidized](https://github.com/ytti/oxidized) a network configuration backup tool.

## Role variables
## Requirements

| Name | Default Value | Description |
| ----------------------- | ----------------- | -----------------------------------|
| `oxidized_version` | 0.28.0 | oxidized version |
| `oxidized_user` | oxidized | oxidized system user |
| `oxidized_group` | oxidized | oxidized system group |
| `oxidized_passwd` | oxidized | oxidized system user password |
| `oxidized_config_dir` | /home/oxidized | config directory |
| `oxidized_storage_dir` | /data/oxidized | location for config files backup |
| `oxidized_log_dir` | /var/log/oxidized | log file location |
| `oxidized_log_debug` | false | debug mode |
| `oxidized_web_listen` | 0.0.0.0 | web listen port |
| `oxidized_web_port` | 8888 | web listen port |
| `oxidized_config_files` | | location of the extra config files |
| `oxidized_model_files` | | location of the model files |
none

## Examples
## Role variables

---
- hosts: apps_oxidized
become: yes
become_method: sudo
gather_facts: yes
roles:
- role: ansible-apps_oxidized
environment:
http_proxy: "{{ http_proxy }}"
https_proxy: "{{ https_proxy }}"
no_proxy: "{{ no_proxy }}
See [variables](/defaults/main.yml) for more details.

## Monitoring
## Examples

Monitoring this tool can be done with a [prometheus exporter](https://github.com/lotusnoir/ansible-apps_oxidized_exporter). You will get the status for each backup.
---
- hosts: apps_oxidized
become: true
become_method: sudo
gather_facts: true
roles:
- role: ansible-apps_oxidized


## License

This project is licensed under Apache License. See [LICENSE](/LICENSE) for more details.

13 changes: 8 additions & 5 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
galaxy_info:
author: "Philippe leal"
description: "Install and configure oxidized, a network config backup tool"
author: lotusnoir
role_name: apps_oxidized
license: "license: Apache License, Version 2.0"
description: "Deploy [oxidized](https://github.com/ytti/oxidized) a network configuration backup tool."
license: "Apache License, Version 2.0"
min_ansible_version: 2.8

platforms:
- name: "Ubuntu"
versions:
- "xenial"
- "focal"
- "bionic"
- name: "Debian"
versions:
- "bullseye"
- "buster"
- "stretch"
- name: "RedHat"
versions:
- "Maipo"

galaxy_tags:
- network
Expand Down
82 changes: 35 additions & 47 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,73 +4,61 @@ dependency:
driver:
name: docker
platforms:
- name: bionic
- name: ubuntu18-apps-oxidized
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-18.04
image: lotusnoir/ansible_molecule_test_images:ubuntu18
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: xenial
- name: ubuntu20-apps-oxidized
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:ubuntu-16.04
image: lotusnoir/ansible_molecule_test_images:ubuntu20
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: stretch
groups:
- python3
- name: debian10-apps-oxidized
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-9
image: lotusnoir/ansible_molecule_test_images:debian10
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: buster
- name: debian11-apps-oxidized
pre_build_image: true
image: quay.io/paulfantom/molecule-systemd:debian-10
image: lotusnoir/ansible_molecule_test_images:debian11
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
#- name: bullseye
# pre_build_image: true
# image: geerlingguy/docker-debian11-ansible #cant start service
# docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
# privileged: true
# volumes:
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
#- name: centos7
# pre_build_image: true
# image: quay.io/paulfantom/molecule-systemd:centos-7
# docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
# privileged: true
# volumes:
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
#- name: centos8
# pre_build_image: true
# image: quay.io/paulfantom/molecule-systemd:centos-8
# docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
# privileged: true
# volumes:
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
# groups:
# - python3
#- name: rocky8
# pre_build_image: true
# image: geerlingguy/docker-rockylinux8-ansible:latest
# docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
# privileged: true
# volumes:
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
#- name: fedora
# pre_build_image: true
# image: quay.io/paulfantom/molecule-systemd:fedora-30
# docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
# privileged: true
# volumes:
# - /sys/fs/cgroup:/sys/fs/cgroup:ro
# groups:
# - python3
- name: centos7-apps-oxidized
pre_build_image: true
image: lotusnoir/ansible_molecule_test_images:centos7
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- name: centos8-apps-oxidized
pre_build_image: true
image: lotusnoir/ansible_molecule_test_images:centos8
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
groups:
- python3
- name: rocky8-apps-oxidized
pre_build_image: true
image: lotusnoir/ansible_molecule_test_images:rocky8
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
groups:
- python3
provisioner:
name: ansible
playbooks:
Expand Down
3 changes: 2 additions & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- name: Run role
hosts: all
become: true
any_errors_fatal: true

roles:
- role: apps_oxidized
- role: ansible-apps_oxidized
Loading

0 comments on commit 4d46436

Please sign in to comment.