Assign interfaces to subnets automatically

Problem:
with ansible callback_foreman newly added hosts are not assigned to subnets automatically, maybe there is a hammer script to do so?

Expected outcome:
assign interfaces to corresponding subnets

Distribution and version:
ansible-collection-theforeman-foreman-2.1.2-1.el7.noarch
ansible-collection-theforeman-operations-0.3.0-1.el7.noarch
ansiblerole-foreman_scap_client-0.2.0-1.el7.noarch
foreman-2.5.3-1.el7.noarch
foreman-cli-2.5.3-1.el7.noarch
foreman-debug-2.5.3-1.el7.noarch
foreman-dynflow-sidekiq-2.5.3-1.el7.noarch
foreman-installer-2.5.3-1.el7.noarch
foreman-installer-katello-2.5.3-1.el7.noarch
foreman-postgresql-2.5.3-1.el7.noarch
foreman-proxy-2.5.3-1.el7.noarch
foreman-release-3.0.0-1.el7.noarch
foreman-selinux-2.5.3-1.el7.noarch
foreman-service-2.5.3-1.el7.noarch
rubygem-foreman_maintain-0.8.6-1.el7.noarch
tfm-rubygem-foreman_ansible-6.3.4-1.fm2_5.el7.noarch
tfm-rubygem-foreman_ansible_core-4.1.2-1.fm2_5.el7.noarch
tfm-rubygem-foreman_openscap-4.3.3-1.fm2_5.el7.noarch
tfm-rubygem-foreman_remote_execution-4.5.6-1.fm2_5.el7.noarch
tfm-rubygem-foreman_remote_execution_core-1.4.8-1.el7.noarch
tfm-rubygem-foreman-tasks-4.1.5-1.fm2_5.el7.noarch
tfm-rubygem-foreman-tasks-core-0.3.6-1.fm2_5.el7.noarch
tfm-rubygem-hammer_cli_foreman-2.5.1-1.el7.noarch
tfm-rubygem-hammer_cli_foreman_ansible-0.3.4-1.fm2_5.el7.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.3.0-2.el7.noarch
tfm-rubygem-hammer_cli_foreman_remote_execution-0.2.1-2.fm2_5.el7.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.15-2.fm2_5.el7.noarch

thanks in advance!

Hi,
just to be sure I get what you mean.

Let’s say you have a host with 192.168.0.5/24 on one of its interfaces, you have a 192.168.0.0/24 subnet in foreman and you would like to get that host’s interface assigned to that subnet when ansible sends facts about the host to foreman?

1 Like

hi, exactly, that would be the perfect scenario

would also be ok to add them afterwards with a triggered job to the right subnet
it’s not an ansible issue, when puppet adds hosts to foreman it does not link the subnets as well

would you consider this more a community than support issue?