Sorry I pasted "foreman.py" in the original post. It is 
"foreman_callback.py" obtained using the url from the manual. "localhost" 
was replaced with the FQDN of my Foreman host, now the modifications are:

FOREMAN_URL = os.getenv('FOREMAN_URL', "https://myforemanhost.domain.com";)
# Substitute by a real SSL certificate and key if your Foreman uses HTTPS
FOREMAN_SSL_CERT = (os.getenv('FOREMAN_SSL_CERT', 
"/etc/foreman/client_cert.pem"),
                    os.getenv('FOREMAN_SSL_KEY', 
"/etc/foreman/client_key.pem"))
FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY', "0")

Yet still no hosts show up in Foreman after running "ansible -m setup 
...".  Thanks!


On Wednesday, April 19, 2017 at 1:57:40 PM UTC-5, J Webb wrote:
>
> Greetings,
>
> I have been unable to add hosts using "ansible -m setup hostname".
>
> I have recently installed Foreman 1.14.3 with the Katello scenario and the 
> Ansible plugin v 2.2.1.0 using "foreman-installer --scenario=katello 
> --enable-foreman-plugin-ansible".  Everything seems to be working fine 
> except for no hosts are showing up using Ansible.  
>
> I have successfully run a playbook on this host and followed these 
> instructions:  
> https://theforeman.org/plugins/foreman_ansible/1.x/index.html
>
> Here are the relevant config changes:
>
> /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py:
>
>    FOREMAN_URL = os.getenv('FOREMAN_URL', "https://localhost";)
>  
> /etc/ansible/ansible.cfg:
>    [defaults]
>    callback_whitelist = foreman
> ...
>    callback_plugins   = 
> /usr/lib/python2.7/site-packages/ansible/plugins/callback
> ...
>    bin_ansible_callbacks = True
>
> The host I'm trying to set up is in trusted_puppetmaster_hosts in Foreman
>
> ignore_puppet_facts_for_provisioning = No
>
> RESULTS:
>
> Running "ansible -m setup hostname" returns no errors, just a lot of 
> system info to stdout.  Here are the foreman production.log entries during 
> the setup:
>
> 2017-04-19 12:53:09 58d05530 [app] [I] Started POST "/api/v2/hosts/facts" 
> for 10.121.66.130 at 2017-04-19 12:53:09 -0500
> 2017-04-19 12:53:09 58d05530 [app] [I] Processing by 
> Api::V2::HostsController#facts as JSON
> 2017-04-19 12:53:09 58d05530 [app] [I]   Parameters: 
> {"facts"=>"[FILTERED]", "name"=>"hostname.domain.com", "apiv"=>"v2", 
> :host=>{"name"=>"hostname.domain.com"}}
> 2017-04-19 12:53:09 58d05530 [audit] [I] [hostname.domain.com] deleted 0 
> (15.0ms)
> 2017-04-19 12:53:10 58d05530 [audit] [I] [hostname.domain.com] updated 18 
> (594.4ms)
> 2017-04-19 12:53:10 58d05530 [audit] [I] [hostname.domain.com] added 0 
> (6.2ms)
> 2017-04-19 12:53:10 58d05530 [app] [I] Import facts for '
> hostname.domain.com' completed. Added: 0, Updated: 18, Deleted 0 facts
> 2017-04-19 12:53:10 58d05530 [app] [I] Completed 201 Created in 755ms 
> (Views: 4.0ms | ActiveRecord: 103.9ms)
> 2017-04-19 12:53:10 c522a2fd [app] [I] Started POST "/api/v2/hosts/facts" 
> for 10.121.66.130 at 2017-04-19 12:53:10 -0500
> 2017-04-19 12:53:10 c522a2fd [app] [I] Processing by 
> Api::V2::HostsController#facts as JSON
> 2017-04-19 12:53:10 c522a2fd [app] [I]   Parameters: 
> {"facts"=>"[FILTERED]", "name"=>"hostname.domain.com", "apiv"=>"v2", 
> :host=>{"name"=>"hostname.domain.com"}}
> 2017-04-19 12:53:10 c522a2fd [audit] [I] [hostname.domain.com] deleted 0 
> (18.9ms)
> 2017-04-19 12:53:10 c522a2fd [audit] [I] [hostname.domain.com] updated 0 
> (532.0ms)
> 2017-04-19 12:53:10 c522a2fd [audit] [I] [hostname.domain.com] added 0 
> (6.4ms)
> 2017-04-19 12:53:10 c522a2fd [app] [I] Import facts for '
> hostname.domain.com' completed. Added: 0, Updated: 0, Deleted 0 facts
> 2017-04-19 12:53:10 c522a2fd [app] [I] Completed 201 Created in 687ms 
> (Views: 8.6ms | ActiveRecord: 94.1ms)
>
> Any advice is greatly appreciated.
>
> Jarret
>

-- 
You received this message because you are subscribed to the Google Groups 
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to