Skip to content

Commit

Permalink
Merge pull request #13 from thorian93/devel
Browse files Browse the repository at this point in the history
Release 0.0.3
  • Loading branch information
thorian93 authored Mar 23, 2024
2 parents a5accbc + 051feee commit d6b20f1
Show file tree
Hide file tree
Showing 32 changed files with 371 additions and 187 deletions.
3 changes: 2 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ skip_list:
# - all

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

# # Define required Ansible's variables to satisfy syntax check
# extra_vars:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# 3. If your collection depends on other collections ensure they are installed, see "Install collection dependencies"
# If you need help please ask in #ansible-community on the Libera.chat IRC network

env:
NAMESPACE: thorian93
COLLECTION_NAME: main

name: Linting
on:
workflow_dispatch:
Expand All @@ -23,10 +27,6 @@ on:
- 'roles/**'
- 'playbooks/**'

env:
NAMESPACE: thorian93
COLLECTION_NAME: main

jobs:

linting:
Expand Down Expand Up @@ -59,13 +59,13 @@ jobs:
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}

- name: Run ansible-lint on roles
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/roles/
working-directory: ./ansible_collections/
run: ansible-lint -c .ansible-lint roles/
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
env:
ANSIBLE_ROLES_PATH: "./thorian93/main/roles"

- name: Run ansible-lint on playbooks
run: ansible-lint -c ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/.ansible-lint ${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}/playbooks/
working-directory: ./ansible_collections/
run: ansible-lint -c .ansible-lint playbooks/
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
env:
ANSIBLE_ROLES_PATH: "./thorian93/main/roles"
6 changes: 2 additions & 4 deletions .github/workflows/molecule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@ on:
pull_request:
branches:
- main
- devel
paths:
- 'roles/**'
push:
branches:
- main
- devel
paths:
- 'roles/**'

env:
NAMESPACE: thorian93
COLLECTION_NAME: main
COLLECTION_NAME: main

jobs:
build:
Expand Down Expand Up @@ -63,5 +61,5 @@ jobs:
- name: Test with molecule
run: |
cd roles/${{ matrix.role }}
molecule test -d docker
molecule test
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}}
47 changes: 21 additions & 26 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
name: Release
name: Release Collection

on: # yamllint disable-line rule:truthy
workflow_dispatch:

env:
NAMESPACE: thorian93
COLLECTION_NAME: main
FILES: "CHANGELOG.rst LICENSE README.md ansible.cfg galaxy.yml"
DIRS: "changelogs meta playbooks roles"

Expand All @@ -12,6 +15,11 @@ jobs:
runs-on: ubuntu-latest

steps:

#
# Prepare the environment.
#

- name: Checkout code
uses: actions/checkout@v4

Expand Down Expand Up @@ -46,7 +54,7 @@ jobs:
run: ansible-galaxy collection build build/src --force

- name: Install Ansible Collection
run: ansible-galaxy collection install ./thorian93-main-${{ steps.current_version.outputs.version }}.tar.gz
run: ansible-galaxy collection install --no-deps ./${{env.NAMESPACE}}-${{env.COLLECTION_NAME}}-${{ steps.current_version.outputs.version }}.tar.gz

- name: Compile Collection Changelog
run: antsibull-changelog release
Expand All @@ -55,8 +63,6 @@ jobs:
uses: peter-evans/create-pull-request@v6
with:
commit-message: Update Changelogs
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: changelogs-update-${{ steps.current_version.outputs.version }}
base: devel
Expand Down Expand Up @@ -85,33 +91,22 @@ jobs:
- name: Build Ansible Collection
run: ansible-galaxy collection build build/src --force

- name: Create Release
- name: Create Release and upload Assets
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.current_version.outputs.version }}
release_name: ${{ steps.current_version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
name: v${{ steps.current_version.outputs.version }}
tag_name: v${{ steps.current_version.outputs.version }}
files: ${{env.NAMESPACE}}-${{env.COLLECTION_NAME}}-${{ steps.current_version.outputs.version }}.tar.gz
body: |
# Ansible Collection: thorian93.main
# Ansible Collection: ${{env.NAMESPACE}}.${{env.COLLECTION_NAME}}
For information about this collection and how to install it, refer to the [README](https://github.com/thorian93/main/blob/main/README.md).
For a detailed changelog, refer to the [CHANGELOG](https://github.com/thorian93/main/blob/main/CHANGELOG.rst).
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: thorian93-main-${{ steps.current_version.outputs.version }}.tar.gz
asset_name: thorian93-main-${{ steps.current_version.outputs.version }}.tar.gz
asset_content_type: application/tar+gzip
For a detailed changelog, refer to the [CHANGELOG](https://github.com/thorian93/main/blob/main/CHANGELOG.rst).
- name: Publish Ansible Collection to the Galaxy
run: ansible-galaxy collection publish thorian93-main-${{ steps.current_version.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }}
run: ansible-galaxy collection publish ${{env.NAMESPACE}}-${{env.COLLECTION_NAME}}-${{ steps.current_version.outputs.version }}.tar.gz --api-key ${{ secrets.GALAXY_API_KEY }}
120 changes: 120 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
SHELL=/bin/bash

VERSION := $$(grep 'version:' galaxy.yml | cut -d ' ' -f 2)

help:
@echo "setup - Run all setup target at once."
@echo ""
@echo "setup-python - Prepare the system for development with Python."
@echo ""
@echo "setup-kvm - Install and enable KVM and prepare Vagrant."
@echo ""
@echo "kvm - Only copy the correct Vagrantfile for use with KVM."
@echo ""
@echo "vm - Create a virtual development environment."
@echo "molecule - Create a virtual environment for molecule tests."
@echo "vms - Create a virtual environment with all boxes (exept for the development ones and ansidows)."
@echo "vms-debian - Create a virtual environment with all Debian family OSes."
@echo "vms-redhat - Create a virtual environment with all RedHat family OSes."
@echo "vms-suse - Create a virtual environment with all Suse family OSes."
@echo ""
@echo "clean - Clean up several things"
@echo "clean-vm - Clean up virtual development environment."
@echo ""
@echo "version - Update collection version"
@echo ""
@echo "Publishing:"
@echo ""
@echo " release - Build, upload, publish, announce and tag a release"
@echo " announce - Announce the release"
@echo " publish - Make files available, update git and announce"
@echo ""

release:
@./scripts/release.sh -s $(VERSION) -t $(RELEASE)

publish:

announce:

setup: setup-python setup-kvm

setup-python:
@sudo apt-get -y update --quiet
@sudo apt-get -y install -y \
python3-pip \
ca-certificates \
curl \
gnupg \
lsb-release
@python3 -m pip install pip --upgrade
@python3 -m pip install -r requirements.txt

kvm:
if [ -f Vagrantfile ] ; then cp Vagrantfile Vagrantfile.bak ; fi
cp Vagrantfile.kvm Vagrantfile
if [ -f playbooks/hosts ] ; then cp playbooks/hosts playbooks/hosts.bak ; fi
cp playbooks/hosts.kvm playbooks/hosts

setup-kvm: kvm
@sudo apt update -y
@sudo apt install -y \
virt-manager \
qemu-kvm \
libvirt-clients \
libvirt-daemon-system \
bridge-utils \
virtinst \
libguestfs-tools \
libvirt-daemon\
libvirt-dev \
libxslt-dev \
libxml2-dev \
zlib1g-dev
@sudo systemctl enable --now libvirtd
@vagrant plugin install vagrant-libvirt

version:
@newversion=$$(dialog --stdout --inputbox "New Version:" 0 0 "$(VERSION)") ; \
if [ -n "$$newversion" ] ; then ./scripts/release.sh -s "$(VERSION)" -t $$newversion ; fi

clean: clean-vm

clean-vm:
@vagrant destroy --force

molecule:
@vagrant up molecule

vm:
@vagrant up collection

vms:
@vagrant up debsible ansibuntu anstream ansuse ansoracle # ansles ## currently no SLES box for libvirt!

vms-debian:
@vagrant up debsible ansibuntu

vms-redhat:
@vagrant up anstream ansoracle

vms-suse:
@vagrant up ansuse # ansles ## currently no SLES box for libvirt!

vms-windows:
@vagrant up ansidows

tests: test-sanity test-linting

test-sanity:
@vagrant ssh -- -t 'cd /home/vagrant/ansible_collections/thorian93/main && /home/vagrant/.local/bin/ansible-test sanity --docker'

test-linting:
@vagrant ssh -- -t 'cd /home/vagrant/ansible_collections/thorian93/main && yamllint -c .yamllint roles/'
@vagrant ssh -- -t 'cd /home/vagrant/ansible_collections/thorian93/main && yamllint -c .yamllint playbooks/'
@vagrant ssh -- -t 'cd /home/vagrant/ansible_collections/thorian93/main && ansible-lint -c .ansible-lint playbooks/'

tests-molecule: test-molecule-upgrade

test-molecule-upgrade:
@vagrant ssh -- -t 'cd /home/vagrant/ansible_collections/thorian93/main/roles/upgrade && molecule test'
8 changes: 4 additions & 4 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Vagrant.configure("2") do |config|
apt-get -y update --quiet
apt-get -y install python3-pip ca-certificates curl gnupg lsb-release
python3 -m pip install pip --upgrade
python3 -m pip install -r /home/vagrant/ansible_collections/thorian93/mainrequirements.txt
sudo -u vagrant ansible-galaxy collection install -f -r /home/vagrant/ansible_collections/thorian93/mainrequirements.yml
python3 -m pip install -r /home/vagrant/ansible_collections/thorian93/main/requirements.txt
sudo -u vagrant ansible-galaxy collection install -f -r /home/vagrant/ansible_collections/thorian93/main/requirements.yml
mkdir -p /home/vagrant/ansible_collections/thorian93/main
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Expand Down Expand Up @@ -61,9 +61,9 @@ Vagrant.configure("2") do |config|
apt-get -y update --quiet
apt-get -y install python3-pip ca-certificates curl gnupg lsb-release
python3 -m pip install pip --upgrade
python3 -m pip install -r /home/vagrant/ansible_collections/thorian93/mainrequirements.txt
python3 -m pip install -r /home/vagrant/ansible_collections/thorian93/main/requirements.txt
python3 -m pip install molecule molecule-plugins[docker]
sudo -u vagrant ansible-galaxy collection install -f -r /home/vagrant/ansible_collections/thorian93/mainrequirements.yml
sudo -u vagrant ansible-galaxy collection install -f -r /home/vagrant/ansible_collections/thorian93/main/requirements.yml
mkdir -p /home/vagrant/ansible_collections/thorian93/main
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
Expand Down
4 changes: 2 additions & 2 deletions ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ show_custom_stats = True
# only be disabled if your sftp version has problems with batch mode
#sftp_batch_mode = False

# The -tt argument is passed to ssh when pipelining is not enabled because sudo
# requires a tty by default.
# The -tt argument is passed to ssh when pipelining is not enabled because sudo
# requires a tty by default.
#usetty = True

# Number of times to retry an SSH connection to a host, in case of UNREACHABLE.
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: thorian93
name: main

# The version of the collection. Must be compatible with semantic versioning
version: 0.0.2
version: 0.0.3

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md
Expand Down
Loading

0 comments on commit d6b20f1

Please sign in to comment.