Hi! I'm quite new to Ansible and Foreman, the way I make the facts working 
is by changing the Foreman callback function that comes with Ansible, 
following what was described in this link 
https://github.com/theforeman/foreman_ansible/issues/86#issuecomment-302123143 
[before 
make changes to the file, make a backup of it]
Plus, I've created a new ssh key on my foreman machine, and I've exported 
it on my hosts for the user 'foreman', to make it able to connect on the 
hosts with SSH. 
But maybe is better to create a 'foreman' user on the hosts: I'm not sure.
Best.
      Pietro Gabelli

On Wednesday, April 19, 2017 at 8:57:40 PM UTC+2, 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