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

theforeman.foreman.host not idempotent #1780

Open
mamercad opened this issue Sep 18, 2024 · 0 comments
Open

theforeman.foreman.host not idempotent #1780

mamercad opened this issue Sep 18, 2024 · 0 comments

Comments

@mamercad
Copy link

SUMMARY

theforeman.foreman.host not idempotent

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
❯ ansible --version
ansible [core 2.15.12]
  config file = redacted/ansible.cfg
  configured module search path = ['redacted/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = redacted/Library/Caches/pypoetry/virtualenvs/foreman-D9iN7Av3-py3.9/lib/python3.9/site-packages/ansible
  ansible collection location = redacted/.ansible/collections:/usr/share/ansible/collections
  executable location = redacted/Library/Caches/pypoetry/virtualenvs/foreman-D9iN7Av3-py3.9/bin/ansible
  python version = 3.9.19 (main, May 22 2024, 11:52:33) [Clang 15.0.0 (clang-1500.3.9.4)] (redacted/Library/Caches/pypoetry/virtualenvs/foreman-D9iN7Av3-py3.9/bin/python)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
❯ ansible-galaxy collection list | grep fore
theforeman.foreman                       4.1.0
KATELLO/FOREMAN VERSION
$ dpkg -l | grep foreman
ii  foreman                           3.11.1-1+ubuntu2204                          amd64        Systems management web interface
ii  foreman-cli                       3.11.1-1+ubuntu2204                          all          metapackage providing hammer CLI for Foreman
ii  foreman-debug                     3.11.1-1+ubuntu2204                          all          provides support utility foreman-debug.
ii  foreman-dynflow-sidekiq           3.11.1-1+ubuntu2204                          all          package providing dynflow sidekiq services for Foreman
ii  foreman-installer                 3.11.1-1+ubuntu2204                          all          Automated puppet-based installer for The Foreman
ii  foreman-postgresql                3.11.1-1+ubuntu2204                          all          metapackage providing PostgreSQL dependencies for Foreman
ii  foreman-proxy                     3.11.1-1+ubuntu2204                          all          RESTful proxies for DNS, DHCP, TFTP, and Puppet
ii  foreman-redis                     3.11.1-1+ubuntu2204                          all          metapackage providing redis dependencies for Foreman
ii  foreman-service                   3.11.1-1+ubuntu2204                          all          package providing Foreman services running via puma
ii  ruby-foreman-discovery            24.0.1-1                                     all          Foreman Discovery Plugin
ii  ruby-foreman-puppet               7.0.0-1~fm3.11                               all          Foreman Puppet Plugin
ii  ruby-hammer-cli-foreman           3.11.0-1+ubuntu2204                          all          Foreman commands for Hammer
ii  ruby-hammer-cli-foreman-puppet    0.1.0-1+ubuntu2204                           all          Foreman Puppet plugin for Hammer CLI
STEPS TO REPRODUCE
# Just run the same play to create a host more than once
...
    - name: "Create host"
      tags: [foreman, config]
      delegate_to: localhost
      theforeman.foreman.host:
        name: "foo"
        hostgroup: "foogroup"
        location: "Default Location"
        mac: "de:ad:be:ef:de:ad"
        organization: "Default Organization"
        state: "present"
EXPECTED RESULTS

It should be idempotent ... should show that the host already exists and no changes were made, etc.

ACTUAL RESULTS
TASK [foreman : Create host] *****************************************************************************
Wednesday 18 September 2024  07:20:48 -0400 (0:00:00.039)       0:00:09.478 *** 
fatal: [redacted -> localhost]: FAILED! => changed=false 
  error:
    errors:
      name:
      - has already been taken
    full_messages:
    - Name has already been taken
    id: null
  msg: 'Error while performing create on hosts: 422 Client Error: Unprocessable Content for url: https://redacted/api/hosts'
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

1 participant