Skip to content

Fixes #27 #87

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 13 additions & 3 deletions foreman_os_default_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
operatingsystem:
description: Operatingsystem name
required: true
major:
description: Major version
required: true
minor:
description: Minor version
required: true
config_template:
description: Config Template name
required: true
Expand Down Expand Up @@ -84,12 +90,14 @@

def ensure():
os_name = module.params['operatingsystem']
major = module.params['major']
minor = module.params['minor']
config_template_name = module.params['config_template']
template_kind_name = module.params['template_kind']
state = module.params['state']

try:
os = theforeman.search_operatingsystem(data=dict(name=os_name))
os = theforeman.search_operatingsystem(data=dict(name=os_name, major=major, minor=minor))
except ForemanError as e:
module.fail_json(msg='Could not search operatingsystem: {0}'.format(e.message))

Expand Down Expand Up @@ -151,10 +159,12 @@ def main():

module = AnsibleModule(
argument_spec=dict(
operatingsystem=dict(type='str', required=True),
config_template=dict(type='str', required=True),
template_kind=dict(type='str', required=True),
major=dict(type='int', required=True),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hui, required would make playbooks not passing the parameter invalid. Is it really necessary?

minor=dict(type='int', required=True),
operatingsystem=dict(type='str', required=True),
state=dict(type='str', default='present', choices=['present', 'absent']),
template_kind=dict(type='str', required=True),
foreman_host=dict(type='str', default='127.0.0.1'),
foreman_port=dict(type='str', default='443'),
foreman_user=dict(type='str', required=True),
Expand Down