Foreman Ansible API doesn't exist

Hi,

I just upgraded to Foreman 1.17.1 hoping it would get the hammer ansible cli working with Foreman (from Foreman 1.16). The ansible plugin works fine within the GUI, but I am having issues getting it to work via API calls and through the ansible hammer cli. It seems like the API is inaccessible (https://IP/api/ansible does not exist).

The hammer ansible --help command works.
hammer ansible roles list yields a 404 Not Found error.

Application versions:
ansible 2.4.2
Foreman 1.17.1
tfm-rubygem-foreman_ansible-2.1.2-1
tfm-rubygem-hammer_cli_foreman-0.12.0-2
tfm-rubygem-hammer_cli_0.12.0-1

Gems:
hammer_cli 0.12.0
hammer_cli_foreman 0.12.1
hammer_cli_foreman_ansible 0.1.0
rack 1.6.4
smart_proxy_ansible 2.0.3
smart_proxy_dynflow 0.2.0

Any help would be appreciated!

Thanks,
Alicia Nguyen

@amnguyen327 I’m not sure about Hammer, but which actions do you want to perform?

On my instance I see https://foreman.example.com/ansible/api/v2/ansible_roles is accessible, also https://centos7-devel.lobatolan.home//api/v2/hosts/samplehost.mydomain.com/play_roles

Similarly you can run job invocations (including playbooks) by calling POST api/job_invocations

There’s a list of all possible actions at https://centos7-devel.lobatolan.home/api/

@dLobatog, I am trying to automate the deployment of some VMs. I’m using a script to kick of the hammer cli deployment of some VMs. I’d like to be able to assign an ansible role to the VMs using either hammer cli or via an API call.

I can see the list of ansible_roles via the API, but I don’t see anywhere in the host API that list either the ansible_role_id or ansible_role name. Is it possible to assign roles via the API?

Thanks,
Alicia