-
Notifications
You must be signed in to change notification settings - Fork 169
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
hostgroup update with puppetclasses or description #1231
Comments
Note that we can update ---
- hosts: localhost
collections:
- theforeman.foreman
gather_facts: false
tasks:
- name: Ensure Hostgroup '{{ name }}' is {{ state }}
hostgroup:
name: "{{ name }}"
updated_name: "{{ updated_name | default(omit) }}"
parent: "{{ parent | default(omit) }}"
# description: "{{ description | default(omit) }}"
locations: "{{ locations | default(omit) }}"
organizations: "{{ organizations | default(omit) }}"
compute_resource: "{{ compute_resource | default(omit) }}"
compute_profile: "{{ compute_profile | default(omit) }}"
domain: "{{ domain | default(omit) }}"
subnet: "{{ subnet | default(omit) }}"
subnet6: "{{ subnet6 | default(omit) }}"
realm: "{{ realm | default(omit) }}"
architecture: "{{ architecture | default(omit) }}"
operatingsystem: "{{ operatingsystem | default(omit) }}"
medium: "{{ installation_medium | default(omit) }}"
ptable: "{{ ptable | default(omit) }}"
pxe_loader: "{{ pxe_loader | default(omit) }}"
root_pass: "{{ root_pass | default(omit) }}"
environment: "{{ puppet_environment | default(omit) }}"
puppetclasses: "{{ puppetclasses | default(omit) }}"
config_groups: "{{ config_groups | default(omit) }}"
puppet_proxy: "{{ puppet_proxy | default(omit) }}"
puppet_ca_proxy: "{{ puppet_ca_proxy | default(omit) }}"
openscap_proxy: "{{ openscap_proxy | default(omit) }}"
organization: "{{ organization | default(omit) }}"
content_source: "{{ content_source | default(omit) }}"
lifecycle_environment: "{{ lifecycle_environment | default(omit) }}"
content_view: "{{ content_view | default(omit) }}"
parameters: "{{ parameters | default(omit) }}"
state: "{{ state }}"
register: result
- name: Update description on Hostgroup '{{ name }}'
when: state == "present"
hostgroup:
name: "{{ name }}"
parent: "{{ parent | default(omit) }}"
description: "{{ description | default(omit) }}"
state: "{{ state }}"
- name: Update puppetclasses on Hostgroup '{{ name }}'
when: state == "present"
hostgroup:
name: "{{ name }}"
parent: "{{ parent | default(omit) }}"
puppetclasses: "{{ puppetclasses | default(omit) }}"
state: "{{ state }}"
- name: Get hostgroup info
when: state == "present"
resource_info:
resource: hostgroups
info: true
search: "title = {{ parent + '/' + name if parent is defined else name }}"
register: result
- name: Show hostgroup details
when: state == "present"
debug:
var: result.resources[0] | dict2items | rejectattr("value", "equalto", none) | list | items2dict |
@mdellweg please take a look if you have some spare cycles |
One thing that I realized (and I think that's undocumented): If you set foreman-ansible-modules/plugins/modules/operatingsystem.py Lines 211 to 220 in 289d311
Wait, no, ignore me. The above is a valid bug, probably. But you're talking about HGs, not OSes. |
@achevalet can you confirm that this PR fixes the problem? |
@achevalet would you have time to look at #1281 and whether that fixes your issue? I think it should, but one never knows ;) |
Hey, my apologies for the delayed response, yes I will check it out next week and let you know. Thanks for that one! |
Just tested it and I confirm that it works like a charm! We can update puppetclasses and/or description in the same task 👍 |
#1281 is merged |
SUMMARY
Hi, I've some issues with the hostgroup module:
puppetclasses
cannot be updateddescription
when passingpuppetclasses
failspuppetclass_ids
is not returned at creationISSUE TYPE
ANSIBLE VERSION
COLLECTION VERSION
KATELLO/FOREMAN VERSION
STEPS TO REPRODUCE
EXPECTED RESULTS
puppetclasses
and/ordescription
updated on same runACTUAL RESULTS
The text was updated successfully, but these errors were encountered: