0.1.0-DEV-20200212-80132
------------------------ * INITIAL: - initial repo commit
This commit is contained in:
commit
616cb434f0
9
.ansible-lint
Normal file
9
.ansible-lint
Normal file
@ -0,0 +1,9 @@
|
||||
parseable: true
|
||||
quiet: false
|
||||
skip_list:
|
||||
- '010'
|
||||
- '201'
|
||||
- '305'
|
||||
- '403'
|
||||
use_default_rules: true
|
||||
verbosity: 1
|
84
.gitlab-ci.yml
Normal file
84
.gitlab-ci.yml
Normal file
@ -0,0 +1,84 @@
|
||||
# CI Mark that build is executed in CI environment
|
||||
# GITLAB_CI Mark that build is executed in GitLab CI environment
|
||||
# CI_SERVER Mark that build is executed in CI environment
|
||||
# CI_SERVER_NAME CI server that is used to coordinate builds
|
||||
# CI_SERVER_VERSION Not yet defined
|
||||
# CI_SERVER_REVISION Not yet defined
|
||||
# CI_BUILD_REF The commit revision for which project is built
|
||||
# CI_BUILD_BEFORE_SHA The first commit that were included in push request
|
||||
# CI_BUILD_REF_NAME The branch or tag name for which project is built
|
||||
# CI_BUILD_ID The unique id of the current build that GitLab CI uses internally
|
||||
# CI_BUILD_REPO The URL to clone the Git repository
|
||||
# CI_PROJECT_ID The unique id of the current project that GitLab CI uses internally
|
||||
# CI_PROJECT_DIR The full path where the repository is cloned and where the build is ran
|
||||
|
||||
|
||||
variables:
|
||||
ANSIBLE_ROLE: "zen_dhcpd"
|
||||
ANSIBLE_ROLE_PATH: "${CI_PROJECT_DIR}"
|
||||
ANSIBLE_EXTRA_VARS: ""
|
||||
|
||||
|
||||
stages:
|
||||
- check_and_lint
|
||||
- test_deploy
|
||||
|
||||
|
||||
### BEGIN TEMPLATES ###
|
||||
.tags_template: &tags_template
|
||||
tags:
|
||||
- zen-ci-workstation
|
||||
|
||||
|
||||
.header_template: &header
|
||||
variables:
|
||||
DOCKER_IMG_TAG: "7.7.1908"
|
||||
|
||||
|
||||
.check_versions_template: &check_vers
|
||||
<<: *tags_template
|
||||
stage: check_and_lint
|
||||
only:
|
||||
- development
|
||||
script:
|
||||
- /usr/bin/hostname
|
||||
- "cd ${CI_PROJECT_DIR} && git log -1"
|
||||
- "ansible --version"
|
||||
- "ansible-lint --version"
|
||||
|
||||
|
||||
.lint_play_template: &lint_play
|
||||
<<: *tags_template
|
||||
stage: check_and_lint
|
||||
only:
|
||||
- development
|
||||
script:
|
||||
- "ansible-lint -v ${ANSIBLE_ROLE_PATH}"
|
||||
|
||||
|
||||
.test_deploy_template: &test_deploy
|
||||
<<: *tags_template
|
||||
stage: test_deploy
|
||||
only:
|
||||
- development
|
||||
script:
|
||||
- cp -av ${ANSIBLE_ROLE_PATH} /etc/ansible/roles/${ANSIBLE_ROLE}
|
||||
- ansible-playbook -v --connection=local ${ANSIBLE_EXTRA_VARS} tests/test.yml
|
||||
### END TEMPLATES ###
|
||||
|
||||
|
||||
### BEGIN JOBS ###
|
||||
Version Checks:
|
||||
<<: *header
|
||||
<<: *check_vers
|
||||
|
||||
|
||||
Lint Play:
|
||||
<<: *header
|
||||
<<: *lint_play
|
||||
|
||||
|
||||
Test Deploy:
|
||||
<<: *header
|
||||
<<: *test_deploy
|
||||
### END JOBS ###
|
38
README.md
Normal file
38
README.md
Normal file
@ -0,0 +1,38 @@
|
||||
Zen DHCPd
|
||||
=========
|
||||
|
||||
A brief description of the role goes here.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||
|
||||
Role Variables
|
||||
--------------
|
||||
|
||||
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||
|
||||
Example Playbook
|
||||
----------------
|
||||
|
||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||
|
||||
- hosts: servers
|
||||
roles:
|
||||
- { role: username.rolename, x: 42 }
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
BSD
|
||||
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
28
defaults/main/dhcpd_vars.yml
Normal file
28
defaults/main/dhcpd_vars.yml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
dhcp_conf_file : /etc/dhcp/dhcpd.conf
|
||||
dhcp_conf_version : 1.0
|
||||
dhcp_conf_revision : 20200212-125405
|
||||
|
||||
|
||||
dhcp_ddns_style : none
|
||||
dhcp_authoritive : "True"
|
||||
|
||||
dhcp_domain_name: "thezengarden.net"
|
||||
|
||||
dhcp_default_lease : 86400
|
||||
dhcp_max_lease : 604800
|
||||
|
||||
|
||||
dhcp_subnet : 10.1.1.0
|
||||
dhcp_netmask : 255.255.255.0
|
||||
dhcp_router : 10.1.1.10
|
||||
dhcp_range_from : 10.1.1.161
|
||||
dhcp_range_to : 10.1.1.199
|
||||
dhcp_broadcast : 10.1.1.255
|
||||
dhcp_dns : 10.1.1.210
|
||||
|
||||
|
||||
# pxeboot stuff
|
||||
pxeboot_file : pxelinux.0
|
||||
pxeboot_server : 10.1.1.193
|
||||
|
7
handlers/main.yml
Normal file
7
handlers/main.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
# handlers file for zen_dhcpd
|
||||
- name: restart dhcpd
|
||||
service:
|
||||
name : dhcpd
|
||||
state: restarted
|
||||
when: ansible_virtualization_type != "docker"
|
52
meta/main.yml
Normal file
52
meta/main.yml
Normal file
@ -0,0 +1,52 @@
|
||||
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
|
||||
# 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)
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
dependencies: []
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
20
tasks/main.yml
Normal file
20
tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
# tasks file for zen_dhcpd
|
||||
- name: install dhcpd package
|
||||
yum: name=dhcp state=present
|
||||
|
||||
|
||||
- name: deploy dhcpd config
|
||||
template:
|
||||
src: templates/dhcpd_conf.j2
|
||||
dest: "/etc/dhcp/dhcpd.conf"
|
||||
mode: 0644
|
||||
notify: restart dhcpd
|
||||
|
||||
|
||||
- name: enable/start dhcpd
|
||||
service:
|
||||
name: dhcpd
|
||||
enabled: yes
|
||||
state: started
|
||||
when: ansible_distribution_major_version == "7" and ansible_virtualization_type != "docker"
|
32
templates/dhcpd_conf.j2
Normal file
32
templates/dhcpd_conf.j2
Normal file
@ -0,0 +1,32 @@
|
||||
#####################################################
|
||||
# The Zen Garden Network #
|
||||
# #
|
||||
# Configuration : {{ dhcp_conf_file }} #
|
||||
# Version : {{ dhcp_conf_version }}-{{ dhcp_conf_revision }} #
|
||||
# #
|
||||
# Chris H. <chris@thezengarden.net> #
|
||||
#####################################################
|
||||
|
||||
|
||||
ddns-update-style {{ dhcp_ddns_style }};
|
||||
|
||||
option domain-name "{{ dhcp_domain_name }}";
|
||||
|
||||
default-lease-time {{ dhcp_default_lease }};
|
||||
max-lease-time {{ dhcp_max_lease }};
|
||||
|
||||
{% if dhcp_authoritive == 'True' %}
|
||||
authoritative;
|
||||
{% endif %}
|
||||
|
||||
subnet {{ dhcp_subnet }} netmask {{ dhcp_netmask }}
|
||||
{
|
||||
range {{ dhcp_range_from }} {{ dhcp_range_to }};
|
||||
option routers {{ dhcp_router }};
|
||||
option broadcast-address {{ dhcp_broadcast }};
|
||||
option domain-name "{{ dhcp_domain_name }}";
|
||||
option domain-name-servers {{ dhcp_dns }};
|
||||
|
||||
filename "{{ pxeboot_file }}";
|
||||
next-server {{ pxeboot_server }};
|
||||
}
|
2
tests/inventory
Normal file
2
tests/inventory
Normal file
@ -0,0 +1,2 @@
|
||||
localhost
|
||||
|
5
tests/test.yml
Normal file
5
tests/test.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
remote_user: root
|
||||
roles:
|
||||
- zen_dhcpd
|
2
vars/main.yml
Normal file
2
vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for zen_dhcpd
|
Loading…
x
Reference in New Issue
Block a user