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

Can't create new host collection with theforeman.foreman.host_collection module #1687

Closed
juma-adventures opened this issue Dec 4, 2023 · 2 comments

Comments

@juma-adventures
Copy link

juma-adventures commented Dec 4, 2023

SUMMARY

I receive the following message when trying to create a new host collection: "msg": "state is present but all of the following are missing: manifest_path"

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible [core 2.14.2]
  config file = /opt/scripts/satellite/ansible.cfg
  configured module search path = ['/home/adruj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /opt/scripts/satellite/collections/ansible_collections
  executable location = /usr/bin/ansible
  python version = 3.11.2 (main, Sep 14 2023, 10:46:13) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

COLLECTION VERSION
# /opt/scripts/satellite/collections/ansible_collections
Collection         Version
------------------ -------
theforeman.foreman 3.15.0

KATELLO/FOREMAN VERSION
package tfm-rubygem-katello is not installed
foreman-3.7.0.9-1.el8sat.noarch

STEPS TO REPRODUCE
---
- hosts: localhost
  gather_facts: no

  tasks:

    - name: Create a host_collection for {{ organization }}
      theforeman.foreman.subscription_manifest:
        username: "{{ username }}"
        password: "{{ password }}"
        server_url: "{{ server_url }}"
        validate_certs: false
        organization: "{{ organization }}"
        name: "Test"
        description: "Test description"
        state: present
EXPECTED RESULTS

That there was a host collection created with the name "Test" and description "Test description".

ACTUAL RESULTS
ansible-playbook [core 2.14.2]
  config file = /opt/scripts/satellite/ansible.cfg
  configured module search path = ['/home/my-user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /opt/scripts/satellite/collections/ansible_collections
  executable location = /usr/bin/ansible-playbook
  python version = 3.11.2 (main, Sep 14 2023, 10:46:13) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
Using /opt/scripts/satellite/ansible.cfg as config file
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with ini plugin
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: create_host_collection.yml ****************************************************************************************************************
1 plays in /opt/scripts/satellite/playbooks/create_host_collection.yml

PLAY [localhost] ************************************************************************************************************************************

TASK [Create a host_collection for Default] ***********************************************************************************
task path: /opt/scripts/satellite/playbooks/create_host_collection.yml:7
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: my-user
<127.0.0.1> EXEC /bin/sh -c 'echo ~my-user && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/my-user/.ansible/tmp `"&& mkdir "` echo /home/my-user/.ansible/tmp/ansible-tmp-1701684230.773028-365018-155195831254483 `" && echo ansible-tmp-1701684230.773028-365018-155195831254483="` echo /home/my-user/.ansible/tmp/ansible-tmp-1701684230.773028-365018-155195831254483 `" ) && sleep 0'
Using module file /opt/scripts/satellite/collections/ansible_collections/theforeman/foreman/plugins/modules/subscription_manifest.py
<127.0.0.1> PUT /home/my-user/.ansible/tmp/ansible-local-365014v3idhvcc/tmpu7fp1oxp TO /home/my-user/.ansible/tmp/ansible-tmp-1701684230.773028-365018-155195831254483/AnsiballZ_subscription_manifest.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/my-user/.ansible/tmp/ansible-tmp-1701684230.773028-365018-155195831254483/ /home/my-user/.ansible/tmp/ansible-tmp-1701684230.773028-365018-155195831254483/AnsiballZ_subscription_manifest.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3.6 /home/my-user/.ansible/tmp/ansible-tmp-1701684230.773028-365018-155195831254483/AnsiballZ_subscription_manifest.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /home/my-user/.ansible/tmp/ansible-tmp-1701684230.773028-365018-155195831254483/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "description": "Test description",
            "manifest_path": null,
            "name": "Test",
            "organization": "Default",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "repository_url": null,
            "server_url": "https://satellite.my-org.com",
            "state": "present",
            "username": "ansible-smals",
            "validate_certs": false
        }
    },
    "msg": "state is present but all of the following are missing: manifest_path"
}

PLAY RECAP ******************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
@evgeni
Copy link
Member

evgeni commented Dec 4, 2023

The playbook you posted uses the theforeman.foreman.subscription_manifest module, which uploads a manifest, not the theforeman.foreman.host_collection one

@juma-adventures
Copy link
Author

The playbook you posted uses the theforeman.foreman.subscription_manifest module, which uploads a manifest, not the theforeman.foreman.host_collection one

Bad copy/paste.
I completely overlooked that, thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants