Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use fcqn following ansible-lint best practices #55

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
003b0a7
resync
Tcharl Jan 3, 2021
0fa616e
resync
Tcharl Jan 3, 2021
cfd869a
update gitignore
Tcharl Jan 10, 2021
235311e
resync with upstreamoss
Tcharl Apr 24, 2021
d9066be
add zone
Tcharl May 2, 2021
9c87165
update tests
Tcharl May 2, 2021
8259ff4
update tests
Tcharl May 2, 2021
f193f93
removed one test
Tcharl May 2, 2021
762bfa1
[skip travis] resync with upstream
Tcharl May 4, 2021
27c917f
[skip travis] resync with upstream
Tcharl May 4, 2021
e0b5824
[travis skip] idempotence
Tcharl May 6, 2021
9ca9afd
[travis skip] idempotence
Tcharl May 6, 2021
b8c8e17
update gitignore
Tcharl Aug 29, 2021
d8a50af
[skip ci] cleanup role
Tcharl Oct 11, 2021
939ccc3
[skip ci] cleanup role
Tcharl Oct 11, 2021
7cb1666
[skip ci] cleanup role
Tcharl Oct 11, 2021
8c03fe2
update namespace
Tcharl Oct 11, 2021
36d3ba4
[skip travis] update to the last fedora version
Tcharl Nov 10, 2021
65a0ca9
[travis skip] rebase with oss upstream
Tcharl Nov 10, 2021
978b3ad
improve lint
Tcharl Nov 21, 2021
ea4779d
set FQCN on all calls
Tcharl May 19, 2022
f29191b
use fcqn following the ansible lint guidelines
Tcharl May 19, 2022
78b266c
rebase from oss upstream
Tcharl May 19, 2022
453578b
remove ansible lint error
Tcharl May 20, 2022
bafbc21
exclude some files from lint
Tcharl May 21, 2022
7e4ffad
[travis-skip] support fedora 36
Tcharl Aug 8, 2022
1177120
update molecule fedora box
Tcharl Aug 8, 2022
d898e1b
deploys to galaxy automagically
Tcharl Apr 30, 2023
cdb84e7
fix github actions requiremements steps
Tcharl Apr 30, 2023
bb52cbb
linting
Tcharl Apr 30, 2023
5e0fcbd
Merge pull request #6 from OsgiliathEnterprise/topr
Tcharl Apr 30, 2023
f129bb5
libvirt tests
Tcharl Apr 30, 2023
7c4d2d8
add community general to collection dependency
Tcharl Apr 30, 2023
0f7bd15
add posargs to tox
Tcharl Apr 30, 2023
646c897
rename role while executin gci
Tcharl Apr 30, 2023
410c8d6
simplify configuration
Tcharl Apr 30, 2023
1f911bd
create path if not exists
Tcharl Apr 30, 2023
09e8eeb
hack idempotence
Tcharl Apr 30, 2023
8068a8d
[ci skip] hack idempotence
Tcharl Apr 30, 2023
fccd72f
ready to release
Tcharl Apr 30, 2023
8ff136b
ready to release
Tcharl Apr 30, 2023
500f887
[ci skip] hack idempotence
Tcharl Apr 30, 2023
9417b03
pull
Tcharl May 1, 2023
c031270
Merge pull request #7 from OsgiliathEnterprise/topr
Tcharl May 1, 2023
c44c551
adjust travis configuration
Tcharl May 2, 2023
e2565f2
adjust travis configuration
Tcharl May 2, 2023
e10b066
adjust travis configuration
Tcharl May 2, 2023
b2c5e45
increase vagrant provision timeout
Tcharl May 2, 2023
98f98a4
adjust molecule configuration
Tcharl May 15, 2023
a457416
use the same log in tests
Tcharl May 19, 2023
8c14c84
[travis skip] linter & github action refinment
Tcharl May 19, 2023
ee19061
[travis skip] commit
Tcharl May 19, 2023
61f4dd8
[skip travis] normalize molecule.yml files
Tcharl Jun 3, 2023
d179ff1
update role dependency according to its original
Tcharl Aug 17, 2023
4c91df8
lint
Tcharl Aug 17, 2023
9d6cbbb
remove collection path entry
Tcharl Aug 17, 2023
1205f33
remove collection path entry
Tcharl Aug 17, 2023
aa7e17c
resync with upstream
Tcharl Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
exclude_paths:
- .cache/
- .tox/
- meta/
- tests/
- molecule/
warn_list:
- schema
- jinja[spacing]
- name[missing]
- name[casing]
- galaxy[no-changelog]
- galaxy[no-runtime]
- galaxy[version-incorrect]
- no-changed-when
- args[module]
skip_list:
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern
32 changes: 32 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name-template: "v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "🚀 Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
label: "chore"
- title: "🧺 Miscellaneous" #Everything except ABAP
label: "misc"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- "major"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
template: |
## Changes
$CHANGES
55 changes: 55 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
# This is a basic workflow to help you get started with Actions
name: Molecule

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
pull_request:
branches:
- master
- tags/*

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
requirements:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
path: tcharl.ansible_role_libvirt_host
- name: install prereq
run: |
cd tcharl.ansible_role_libvirt_host
ansible-galaxy role install -r requirements-standalone.yml
ansible-galaxy collection install -r requirements-collections.yml
lint:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
path: tcharl.ansible_role_libvirt_host
- name: update apt
run: |
sudo apt update
- name: install tox apt prerequisite
run: |
sudo apt -y install sudo python3 python3-pip
- name: pip install packages
run: |
pip3 install wheel setuptools tox
# - name: Test KVM conditions fails
# run: |
# sudo kvm-ok
- name: tox lint
run: |
cd tcharl.ansible_role_libvirt_host
tox -e lint
17 changes: 17 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- main
- master

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/release-galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Ansible Galaxy
on:
push:
branches:
- main
- master
release:
types:
- published

jobs:
galaxy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Trigger a new import on Galaxy.
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
.cache
__pycache__
36 changes: 36 additions & 0 deletions .tox/converge/.tox-info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"ToxEnv": {
"name": "converge",
"type": "VirtualEnvRunner"
},
"Python": {
"version_info": [
3,
11,
3,
"final",
0
],
"executable": "/usr/local/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/bin/python3.11",
"virtualenv version": "20.23.0"
},
"PythonRun": {
"deps": {
"options": [],
"requirements": [
"ansible-lint",
"flake8",
"jmespath",
"molecule-plugins[vagrant]",
"pytest-testinfra",
"python-vagrant",
"yamllint"
],
"constraints": [],
"constraint_options": {
"constrain_package_deps": false,
"use_frozen_constraints": false
}
}
}
}
59 changes: 34 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
---
language: python
python: "2.7"

# Use the new container infrastructure
sudo: false
dist: jammy

# Install ansible
language: python
python:
- "3.11"
addons:
apt:
sources:
- sourceline: 'deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main'
key_url: 'https://apt.releases.hashicorp.com/gpg'
update: true
packages:
- python-pip
- bridge-utils
- dnsmasq-base
- ebtables
- virtinst
- libvirt-dev
- libvirt-daemon-system
- qemu-kvm
- qemu-utils
- ruby-dev
- ca-certificates
- curl
- gcc
- iproute2
- sudo
- vagrant

install:
# Install ansible
- pip install ansible ansible-lint

# Check ansible version
- ansible --version

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

# Compensate for repo name being different to the role
- ln -s $(pwd) ../stackhpc.libvirt-host
# - wget https://releases.hashicorp.com/vagrant/$VAGRANT_VER/vagrant_"$VAGRANT_VER"_x86_64.deb
# - sudo apt -y install ./vagrant_"$VAGRANT_VER"_x86_64.deb
- vagrant plugin install vagrant-libvirt
- pip install wheel pyopenssl tox
- sudo chmod o+rwx /var/run/libvirt/libvirt-sock
- sh configure

script:
# Run Ansible lint against the role
- ansible-lint tasks/main.yml

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

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
- mv ../ansible-role-libvirt-host ../tcharl.ansible_role_libvirt_host
- travis_wait 30 tox -e test-exec -- --scenario-name kvm
branches:
only:
- master
35 changes: 35 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# Based on ansible-lint config
extends: default
ignore: |
.cache
.tox
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
see release drafter results
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ should be a dict containing the following items:
`libvirt_host_networks` is a list of networks to define and start. Each item
should be a dict containing the following items:
- `name` The name of the network.
- `mode` The forwarding mode of the network, `bridge`, `route` and `nat` are
supported.
- `mode` The forwarding mode of the network, `bridge`, `route`, `open` and `nat` are
supported. Leave empty for a isolated network mode.
- `bridge` The name of the bridge interface for this network.
- `ip` IP address of the virtual bridge, mandatory for `route` and `nat` mode.
- `netmask` Netmask of the virtual bridge, mandatory for `route` and `nat` mode.
- `domain` DNS domain name for `route` and `nat` mode, default to the network
- `zone` the firewalld zone for the bridge (defaults to public)
- `ip` IP address of the virtual bridge, mandatory for `route`, `open` and `nat` mode.
- `netmask` Netmask of the virtual bridge, mandatory for `route`, `open` and `nat` mode.
- `domain` DNS domain name for `route`, `open` and `nat` mode, default to the network
name (optional).
- `dhcp_start` First IP of the DHCP range in `route` or `nat` mode (optional).
- `dhcp_end` Last IP of the DHCP range in `route` or `nat` mode (optional).
- `dhcp_start` First IP of the DHCP range in `route`, `open` or `nat` mode (optional).
- `dhcp_end` Last IP of the DHCP range in `route`, `open` or `nat` mode (optional).
- `routes` Optional list of additionals routes defined as following:
- `address` Address of the route, required.
- `prefix` Prefix of the route, required.
Expand Down Expand Up @@ -193,7 +194,7 @@ storage pools.
Dependencies
------------

None
* [The LVM role](https://github.com/mrlesmithjr/ansible-manage-lvm) You can install it using `ansible-galaxy install -r requirements.yml --roles-p ../community`

Example Playbook
----------------
Expand All @@ -203,6 +204,11 @@ Example Playbook
hosts: all
roles:
- role: stackhpc.libvirt-host
lvm_groups: # see according properties on [The LVM role](https://github.com/mrlesmithjr/ansible-manage-lvm)
- vgname: libvirtvg
disks:
- /dev/sdb1
create: true
libvirt_host_pools:
- name: my-pool
type: dir
Expand All @@ -212,11 +218,8 @@ Example Playbook
owner: my-user
group: my-group
- name: lvm_pool
type: logical
source: vg1
target: /dev/vg1
pvs:
- /dev/sda3
type: lvm2
source: libvirtvg
- name: rbd-pool
type: rbd
source: rbd
Expand Down
3 changes: 3 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

vagrant plugin install vagrant-persistent-storage
Loading