mirror of
https://github.com/GeekOops/geekoops-next.git
synced 2024-05-08 09:21:24 +00:00
Add GitHub Actions
This commit is contained in:
parent
acb72d65f8
commit
daabadc4de
42
.github/workflows/CI.yml
vendored
Normal file
42
.github/workflows/CI.yml
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
name: Test deployment
|
||||
'on':
|
||||
pull_request:
|
||||
push:
|
||||
schedule:
|
||||
# Run every Wednesday at 01:42
|
||||
- cron: "42 1 * * 3"
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out codebase
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: pip3 install yamllint
|
||||
- name: Lint repository
|
||||
run: yamllint .
|
||||
|
||||
molecule:
|
||||
name: Molecule
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the codebase
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Install dependencies
|
||||
run: pip3 install ansible molecule[docker] docker pytest testinfra
|
||||
- name: Run Molecule
|
||||
run: molecule test
|
||||
env:
|
||||
PY_COLORS: '1'
|
||||
ANSIBLE_FORCE_COLOR: '1'
|
34
.yamllint
Normal file
34
.yamllint
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
|
||||
yaml-files:
|
||||
- '*.yaml'
|
||||
- '*.yml'
|
||||
- '.yamllint'
|
||||
|
||||
rules:
|
||||
braces: enable
|
||||
brackets: enable
|
||||
colons: enable
|
||||
commas: enable
|
||||
comments:
|
||||
level: warning
|
||||
comments-indentation:
|
||||
level: warning
|
||||
document-end: disable
|
||||
document-start:
|
||||
level: warning
|
||||
empty-lines: enable
|
||||
empty-values: disable
|
||||
hyphens: enable
|
||||
indentation: enable
|
||||
key-duplicates: enable
|
||||
key-ordering: disable
|
||||
line-length:
|
||||
level: warning
|
||||
new-line-at-end-of-file: enable
|
||||
new-lines: enable
|
||||
octal-values: disable
|
||||
quoted-strings: disable
|
||||
trailing-spaces: enable
|
||||
truthy:
|
||||
level: warning
|
|
@ -1,3 +1,5 @@
|
|||
[![Test deployment](https://github.com/GeekOops/geekoops-next/actions/workflows/CI.yml/badge.svg)](https://github.com/GeekOops/geekoops-next/actions/workflows/CI.yml)
|
||||
|
||||
# geekoops-next
|
||||
|
||||
Install and configure a NEXT (Network Boot) server using `dnsmasq`.
|
||||
|
|
Binary file not shown.
BIN
files/next.zip
Normal file
BIN
files/next.zip
Normal file
Binary file not shown.
|
@ -1,53 +1,23 @@
|
|||
---
|
||||
galaxy_info:
|
||||
author: your name
|
||||
description: your role description
|
||||
company: your company (optional)
|
||||
|
||||
# If the issue tracker for your role is not on github, uncomment the
|
||||
# next line and provide a value
|
||||
author: Felix Niederwanger
|
||||
description: Configurable nginx setup role
|
||||
company: SUSE
|
||||
# issue_tracker_url: http://example.com/issue/tracker
|
||||
|
||||
# Choose a valid license ID from https://spdx.org - some suggested licenses:
|
||||
# - BSD-3-Clause (default)
|
||||
# - MIT
|
||||
# - GPL-2.0-or-later
|
||||
# - GPL-3.0-only
|
||||
# - Apache-2.0
|
||||
# - CC-BY-4.0
|
||||
license: license (GPL-2.0-or-later, MIT, etc)
|
||||
license: MIT
|
||||
|
||||
min_ansible_version: 2.9
|
||||
|
||||
# If this a Container Enabled role, provide the minimum Ansible Container version.
|
||||
# min_ansible_container_version:
|
||||
|
||||
#
|
||||
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||
# To view available platforms and versions (or releases), visit:
|
||||
# https://galaxy.ansible.com/api/v1/platforms/
|
||||
#
|
||||
# platforms:
|
||||
# - name: Fedora
|
||||
# versions:
|
||||
# - all
|
||||
# - 25
|
||||
# - name: SomePlatform
|
||||
# versions:
|
||||
# - all
|
||||
# - 1.0
|
||||
# - 7
|
||||
# - 99.99
|
||||
platforms:
|
||||
- name: opensuse
|
||||
versions:
|
||||
- 15.2
|
||||
|
||||
galaxy_tags: []
|
||||
# List tags for your role here, one per line. A tag is a keyword that describes
|
||||
# and categorizes the role. Users find roles by searching for tags. Be sure to
|
||||
# remove the '[]' above, if you add tags to this list.
|
||||
#
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
galaxy_tags: ['pxe', 'next', 'netboot']
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
|
7
molecule/default/converge.yml
Normal file
7
molecule/default/converge.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: "Include geekoops-next"
|
||||
include_role:
|
||||
name: "geekoops-next"
|
29
molecule/default/molecule.yml
Normal file
29
molecule/default/molecule.yml
Normal file
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
platforms:
|
||||
- name: leap15_2
|
||||
image: grisu48/leap-ansible
|
||||
pre_build_image: true
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
capabilities:
|
||||
- SYS_ADMIN
|
||||
privileged: true
|
||||
tmpfs:
|
||||
- /run
|
||||
- /tmp
|
||||
provisioner:
|
||||
name: ansible
|
||||
inventory:
|
||||
host_vars:
|
||||
leap15_2:
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
17
molecule/default/tests/test_default.py
Executable file
17
molecule/default/tests/test_default.py
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import testinfra.utils.ansible_runner
|
||||
import os
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
|
||||
def test_pxe(host):
|
||||
# TODO: Extend the test coverage.
|
||||
tftpboot = "/srv/tftpboot"
|
||||
cmd = host.run("curl -v tftp://127.0.0.1/pxelinux.0 -o /tmp/pxelinux.0")
|
||||
print(cmd.stdout)
|
||||
assert cmd.succeeded
|
||||
cmd = host.run(f'diff {tftpboot}/pxelinux.0 /tmp/pxelinux.0')
|
||||
assert cmd.succeeded
|
|
@ -10,7 +10,7 @@
|
|||
package:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
tags: ['dnsmasq','tftp']
|
||||
tags: ['dnsmasq', 'tftp']
|
||||
- name: Configure dnsmasq
|
||||
template:
|
||||
src: dnsmasq.j2
|
||||
|
@ -19,7 +19,7 @@
|
|||
group: root
|
||||
mode: 0755
|
||||
notify: restart dnsmasq
|
||||
tags: ['dnsmasq','tftp']
|
||||
tags: ['dnsmasq', 'tftp']
|
||||
- name: Ensure pxelinux.cfg is present
|
||||
file:
|
||||
path: "{{tftp_root}}/pxelinux.cfg"
|
||||
|
@ -27,16 +27,16 @@
|
|||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
tags: ['dnsmasq','tftp']
|
||||
tags: ['dnsmasq', 'tftp']
|
||||
- name: Extract NEXT template
|
||||
unarchive:
|
||||
src: next.tar.bz2
|
||||
src: next.zip
|
||||
dest: "{{tftp_root}}/"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
keep_newer: yes
|
||||
tags: ['dnsmasq','tftp']
|
||||
tags: ['dnsmasq', 'tftp']
|
||||
- name: Configure pxelinux.cfg default
|
||||
template:
|
||||
src: pxelinux_default.j2
|
||||
|
@ -44,14 +44,15 @@
|
|||
owner: root
|
||||
group: root
|
||||
mode: 0755
|
||||
tags: ['dnsmasq','tftp']
|
||||
force: no
|
||||
tags: ['dnsmasq', 'tftp']
|
||||
|
||||
- name: Ensure dnsmasq is started and enabled
|
||||
systemd:
|
||||
name: "{{ dnsmasq_service }}"
|
||||
state: started
|
||||
enabled: true
|
||||
tags: ['dnsmasq','tftp']
|
||||
tags: ['dnsmasq', 'tftp']
|
||||
|
||||
- include: firewall.yml
|
||||
when: config_firewall == true
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
# vars file for geekoops-next
|
||||
# vars file for geekoops-next
|
||||
|
|
|
@ -3,9 +3,8 @@
|
|||
|
||||
## Software packages
|
||||
|
||||
packages: ['dnsmasq']
|
||||
packages: ['dnsmasq', 'unzip']
|
||||
|
||||
dnsmasq_service: "dnsmasq"
|
||||
|
||||
tftp_root: "/srv/tftpboot"
|
||||
|
||||
|
|
Loading…
Reference in a new issue