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

Add initial functionality for Cobbler formula #4

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
- ubuntu-2204
# - ubuntu2004
# - ubuntu1804
- centos-stream8
# - centos-stream8
- centos-stream9
# - centos-7
- fedora-36
# - fedora35
Expand Down
3 changes: 2 additions & 1 deletion FORMULA
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ os: Debian, Ubuntu, Raspbian, RedHat, Fedora, CentOS, Amazon, Oracle, Suse, open
os_family: Debian, RedHat, Suse
version: 1.3.0
release: 1
minimum_version: 2019.2
# This is due to the dict_to_sls_yaml_params filter for the kernel options
minimum_version: 3005
summary: cobbler formula
description: Formula to use to manage the autoinstallation server Cobbler
top_level_dir: cobbler
36 changes: 35 additions & 1 deletion cobbler/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include:
cobbler-config-file-file-managed:
file.managed:
- name: {{ cobbler.config }}
- source: {{ files_switch(['example.tmpl'],
- source: {{ files_switch([ cobbler.version + '/settings.yaml.jinja'],
lookup='cobbler-config-file-file-managed'
)
}}
Expand All @@ -26,3 +26,37 @@ cobbler-config-file-file-managed:
- sls: {{ sls_package_install }}
- context:
cobbler: {{ cobbler | json }}

cobbler-modules-file-file-managed:
file.managed:
- name: /etc/cobbler/modules.conf
- source: {{ files_switch([ cobbler.version + '/modules.conf.jinja'],
lookup='cobbler-modules-file-file-managed'
)
}}
- mode: 644
- user: root
- group: {{ cobbler.rootgroup }}
- makedirs: True
- template: jinja
- require:
- sls: {{ sls_package_install }}
- context:
cobbler: {{ cobbler | json }}

cobbler-mongodb-file-file-managed:
file.managed:
- name: /etc/cobbler/mongodb.conf
- source: {{ files_switch([ cobbler.version + '/mongodb.conf.jinja'],
lookup='cobbler-mongodb-file-file-managed'
)
}}
- mode: 644
- user: root
- group: {{ cobbler.rootgroup }}
- makedirs: True
- template: jinja
- require:
- sls: {{ sls_package_install }}
- context:
cobbler: {{ cobbler | json }}
20 changes: 20 additions & 0 deletions cobbler/files/default/3.2.0/modules.conf.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Cobbler module configuration file
# Documentation: https://cobbler.readthedocs.io/en/latest/cobbler-conf.html#modules-conf

# THIS FILE IS MANAGED BY SALTSTACK!

[authentication]
module = authentication.{{ cobbler['authentication']['module'] }}
hash_algorithm = sha3_512

[authorization]
module = authorization.{{ cobbler['authorization']['module'] }}

[dns]
module = managers.{{ cobbler['dns']['module'] }}

[dhcp]
module = managers.{{ cobbler['dhcp']['module'] }}

[tftpd]
module = managers.{{ cobbler['tftp']['module'] }}
6 changes: 6 additions & 0 deletions cobbler/files/default/3.2.0/mongodb.conf.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Cobbler MongoDB configuration file
# THIS FILE IS MANAGED BY SALTSTACK!

[connection]
host = localhost
port = 27017
142 changes: 142 additions & 0 deletions cobbler/files/default/3.2.0/settings.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Cobbler settings file
# THIS FILE IS MANAGED BY SALTSTACK!
# This config file is in YAML 1.2 format; see "http://yaml.org".

allow_duplicate_hostnames: 0
allow_duplicate_ips: 0
allow_duplicate_macs: 0
allow_dynamic_settings: 0
anamon_enabled: 0
authn_pam_service: "login"
auth_token_expiration: 3600
autoinstall_snippets_dir: /var/lib/cobbler/snippets
autoinstall_templates_dir: /var/lib/cobbler/templates
boot_loader_conf_template_dir: "/etc/cobbler/boot_loader_conf"
build_reporting_enabled: 0
build_reporting_sender: ""
build_reporting_email: [ 'root@localhost' ]
build_reporting_smtp_server: "localhost"
build_reporting_subject: ""
build_reporting_ignorelist: [ "" ]
cache_enabled: 1
cheetah_import_whitelist:
- "random"
- "re"
- "time"
- "netaddr"
createrepo_flags: "-c cache -s sha"
default_autoinstall: /var/lib/cobbler/autoinstall_templates/default.ks
default_name_servers: []
default_name_servers_search: []
{% if not cobbler['authorization']['default_ownership'] -%}
default_ownership: []
{% else -%}
default_ownership:
{% for owner in cobbler['authorization']['default_ownership'] -%}
- {{ owner|yaml_encode }}
{% endfor -%}
{% endif %}
default_password_crypted: {{ cobbler['authentication']['password']|yaml_encode }}
default_template_type: "cheetah"
default_virt_bridge: xenbr0
default_virt_file_size: 5
default_virt_ram: 512
default_virt_type: xenpv
enable_gpxe: {{ cobbler['bootloaders']['ipxe']['enabled']|int }}
enable_menu: {{ cobbler['menu']['enabled']|int }}
http_port: 80
{% if not cobbler.get("default_kernel_options", {}) -%}
kernel_options: {}
{% else -%}
kernel_options:
{{ cobbler.get("default_kernel_options", {}) | dict_to_sls_yaml_params | indent }}
{% endif -%}
ldap_server: "ldap.example.com"
ldap_base_dn: "DC=example,DC=com"
ldap_port: 389
ldap_tls: 1
ldap_anonymous_bind: 1
ldap_search_bind_dn: ''
ldap_search_passwd: ''
ldap_search_prefix: 'uid='
ldap_tls_cacertfile: ''
ldap_tls_keyfile: ''
ldap_tls_certfile: ''
mgmt_classes: []
mgmt_parameters:
from_cobbler: 1
puppet_auto_setup: 0
sign_puppet_certs_automatically: 0
puppetca_path: "/usr/bin/puppet"
remove_old_puppet_certs_automatically: 0
manage_dhcp: {{ (cobbler['dhcp']['v4'] or cobbler['dhcp']['v6'])|int }}
manage_dns: {{ cobbler['dns']['enabled']|int }}
bind_chroot_path: ""
bind_master: {{ cobbler['dns']['bind']['master']|yaml_encode }}
manage_tftpd: {{ cobbler['tftp']['enabled']|int }}
tftpboot_location: {{ cobbler['tftp']['location']|yaml_encode }}
manage_rsync: {{ cobbler['rsync']['enabled']|int }}
{% if not cobbler['dns']['bind']['forward_zones'] -%}
manage_forward_zones: []
{% else -%}
manage_forward_zones:
{% for zone in cobbler['dns']['bind']['forward_zones'] -%}
- {{ zone|yaml_encode }}
{% endfor -%}
{% endif %}
{% if not cobbler['dns']['bind']['forward_zones'] -%}
manage_reverse_zones: []
{% else -%}
manage_reverse_zones:
{% for zone in cobbler['dns']['bind']['reverse_zones'] -%}
- {{ zone|yaml_encode }}
{% endfor -%}
{% endif %}
next_server: {{ cobbler['nextserver']['v4']|yaml_dquote }}
power_management_default_type: {{ cobbler['power_management']['default_type']|yaml_dquote }}
pxe_just_once: 1
nopxe_with_triggers: 1
redhat_management_server: "xmlrpc.rhn.redhat.com"
redhat_management_permissive: 0rsync
redhat_management_key: ""
register_new_installs: 0
reposync_flags: "-l -n -d"
reposync_rsync_flags: "-rltDv --copy-unsafe-links"
restart_dns: 1
restart_dhcp: 1
run_install_triggers: 1
scm_track_enabled: {{ cobbler['scm_track']['enabled']|int }}
scm_track_mode: {{ cobbler['scm_track']['mode']|yaml_dquote }}
scm_track_author: {{ cobbler['scm_track']['author']|yaml_dquote }}
scm_push_script: {{ cobbler['scm_track']['push_script']|yaml_dquote }}
server: {{ cobbler['server'] }}
client_use_localhost: 0
client_use_https: 0
virt_auto_boot: 1
webdir: "{{ cobbler['webdir'] }}/cobbler"
webdir_whitelist:
- misc
- web
- webui
- localmirror
- repo_mirror
- distro_mirror
- images
- links
- pub
- repo_profile
- repo_system
- svc
- rendered
- .link_cache
xmlrpc_port: 25151
yum_post_install_mirror: 1
yum_distro_priority: 1
yumdownloader_flags: "--resolve"
serializer_pretty_json: 0
replicate_rsync_options: "-avzH"
replicate_repo_rsync_options: "-avzH"
always_write_dhcp_entries: 0
proxy_url_ext: ""
proxy_url_int: ""
include: [ "/etc/cobbler/settings.d/*.settings" ]
20 changes: 20 additions & 0 deletions cobbler/files/default/3.2.1/modules.conf.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Cobbler module configuration file
# Documentation: https://cobbler.readthedocs.io/en/latest/cobbler-conf.html#modules-conf

# THIS FILE IS MANAGED BY SALTSTACK!

[authentication]
module = authentication.{{ cobbler['authentication']['module'] }}
hash_algorithm = sha3_512

[authorization]
module = authorization.{{ cobbler['authorization']['module'] }}

[dns]
module = managers.{{ cobbler['dns']['module'] }}

[dhcp]
module = managers.{{ cobbler['dhcp']['module'] }}

[tftpd]
module = managers.{{ cobbler['tftp']['module'] }}
6 changes: 6 additions & 0 deletions cobbler/files/default/3.2.1/mongodb.conf.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Cobbler MongoDB configuration file
# THIS FILE IS MANAGED BY SALTSTACK!

[connection]
host = localhost
port = 27017
Loading
Loading