Facts not being imported by foreman 1.15 & ansible 2.3 - Reports & host creation work fine

Hey All,

I've just installed foreman & ansible freshly on Cent OS7.

Foreman works fine, I wrote a basic playbook that gathers the facts and
copies a file in place.

··· --- - name: test the ansible hosts: - foreman.levene.local gather_facts: yes tasks: - name: test the file copy: src=/tmp/aa dest=/etc/

This all works OK, and it creates the hosts (followed
Foreman :: Plugin Manuals)

PLAY [test the ansible]


TASK [Gathering Facts]


ok: [foreman.levene.local]

TASK [test the file]


ok: [foreman.levene.local]

PLAY RECAP


foreman.levene.local : ok=2 changed=0 unreachable=0 failed=0

In foreman however, the host has no facts. I can see them all gathered in
the report, but they don’t seem to be correctly detected/imported into
foreman facts.

Is this a bug? or have I missed a setting somewhere?

Thanks
David

1 Like

Same here with Foreman/Katello 1.13.4 and ansible 2.3

··· Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene: > > Hey All, > > I've just installed foreman & ansible freshly on Cent OS7. > > Foreman works fine, I wrote a basic playbook that gathers the facts and > copies a file in place. > > --- > - name: test the ansible > hosts: > - foreman.levene.local > gather_facts: yes > tasks: > - name: test the file > copy: src=/tmp/aa dest=/etc/ > > > This all works OK, and it creates the hosts (followed > https://theforeman.org/plugins/foreman_ansible/1.x/index.html) > > PLAY [test the ansible] > ******************************************************************************************************************************************************************************** > > TASK [Gathering Facts] > ********************************************************************************************************************************************************************************* > ok: [foreman.levene.local] > > TASK [test the file] > *********************************************************************************************************************************************************************************** > ok: [foreman.levene.local] > > PLAY RECAP > ********************************************************************************************************************************************************************************************* > foreman.levene.local : ok=2 changed=0 unreachable=0 failed= > 0 > > In foreman however, the host has no facts. I can see them all gathered in > the report, but they don't seem to be correctly detected/imported into > foreman facts. > > Is this a bug? or have I missed a setting somewhere? > > Thanks > David > > >
1 Like

Hey there,

I reported a similar issue some time ago. (see my mail below)

I can not get the Callback Plugin to work. Do you have issues there as
well, David, Philipp? If not, can I ask how you set the ansible plugin
and the callback up?

The problem with fact importing I have as well! Foreman 1.14.

> Hello there,
>
> I was hoping to get some help with the Foreman-Ansible Plugin, because
> I am having a problem I cannot resolve myself.
>
> My Foreman is Version 1.14
> I set up everything according to the instructions found on
> Foreman :: Plugin Manuals
> Additionally I ran foreman-installer -i to set up
> foreman_proxy_plugin_ansible
> foreman_proxy_plugin_remote_execution_ssh
> foreman_plugin_ansible
> I kickstarted a host "centos7.dev" from Foreman, that has basically
> only a puppet environment and a puppet master (the foreman server itself).
> I added "centos7.dev" as a trusted puppetmaster host and added an
> ansible role to it.
> When I am trying to run that role , the run itself works, however I
> get this error on the RECAP
>
> PLAY RECAP *********************************************************************
> centos7.dev : ok=9 changed=0 unreachable=0 failed=0
>
> [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin
> (</usr/lib/python2.7/site-
> packages/ansible/plugins/callback/foreman.CallbackModule object at 0x1753f90>):
> [Errno 2] No such file or directory
>
> I don't see a tab for "facts" in my host view and I have no reports
> resulting from the play.
>
> Can anybody maybe help me with that?
>
> Many thanks in advance.

Many thanks in advance.

··· On 05/26/2017 02:37 PM, Philipp Wehling wrote: > Same here with Foreman/Katello 1.13.4 and ansible 2.3 > > Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene: > > Hey All, > > I've just installed foreman & ansible freshly on Cent OS7. > > Foreman works fine, I wrote a basic playbook that gathers the > facts and copies a file in place. > > > > --- > -name:test the ansible > hosts: > -foreman.levene.local > gather_facts:yes > tasks: > -name:test the file > copy:src=/tmp/aa dest=/etc/ > > > > > This all works OK, and it creates the hosts (followed > https://theforeman.org/plugins/foreman_ansible/1.x/index.html > ) > > > > PLAY [test the > ansible]******************************************************************************************************************************************************************************** > > TASK > [GatheringFacts]********************************************************************************************************************************************************************************* > ok:[foreman.levene.local] > > TASK [test the > file]*********************************************************************************************************************************************************************************** > ok:[foreman.levene.local] > > PLAY RECAP > ********************************************************************************************************************************************************************************************* > foreman.levene.local:ok=2 changed=0 unreachable=0 failed=0 > > > > In foreman however, the host has no facts. I can see them all > gathered in the report, but they don't seem to be correctly > detected/imported into foreman facts. > > Is this a bug? or have I missed a setting somewhere? > > Thanks > David > > > -- > 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 foreman-users+unsubscribe@googlegroups.com > . > To post to this group, send email to foreman-users@googlegroups.com > . > Visit this group at https://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout.


Herzliche Grüße aus München

 Bernhard Hopfenmüller
 ______________________________________________________
 Dr. Bernhard Hopfenmüller

 (IT-Consultant)

 Tel:  +49 (0)89 452 35 38-165
 Fax: +49 (0)89 452 35 38-290
 E-Mail: hopfenmueller@atix.de
 XING: https://www.xing.com/profile/Bernhard_Hopfenmueller?sc_o=mxb_p
 LinkedIn: https://de.linkedin.com/in/bernhard-hopfenmüller-74a83095


 ATIX - The Linux & Open Source Company

 ATIX Informationstechnologie und Consulting AG
 Einsteinstraße 10
 85716 Unterschleißheim
 www.atix.de

 Registergericht: Amtsgericht München, Registernummer: HRB 168930
 USt.-Id.: DE209485962
 Vorstand: Thomas Merz (Vors.), Mark Hlawatschek
 Vorsitzender des Aufsichtsrats: Dr. Martin Bus

Hey,

Firstly, i have opened an issue with foreman so it can be tracked.

http://projects.theforeman.org/issues/19661

@Bernhard - I think the instructions on the foreman/ansible page
(Foreman :: Plugin Manuals) lack a few
things…

update your /etc/ansible/ansible.cfg and add in the foreman whitelist bit "callback_whitelist
= foreman" - as per the guide.

  1. If you are using ansible 2.2+, then you edit this file
    /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py

And make updates like the following;

FOREMAN_URL = os.getenv('FOREMAN_URL', "https://foreman.levene.local:443")
FOREMAN_SSL_CERT =
(os.getenv('FOREMAN_SSL_CERT',"/etc/puppetlabs/puppet/ssl/certs/foreman.levene.local.pem"),
os.getenv('FOREMAN_SSL_KEY',"/etc/puppetlabs/puppet/ssl/private_keys/foreman.levene.local.pem"))
FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY',
"/etc/puppetlabs/puppet/ssl/certs/ca.pem") <-- You can set this to 0 or
set it to your CA's path.

I didn't have it working initially, but did a full reboot of my test
machine and it started working… probably just need to restart foreman or
something similar (https is via passenger)

I tested via a basic playbook and seemed to get more feedback.

As for getting playbooks in foreman its worth noting

  • foreman reads roles from /etc/ansible/roles folder - i created a simple
    one in there and was able to tell foreman to run it after importing.
  • You can then assign ansible roles to hosts after importing, and run.

Hope this helps you out a bit & I hope a dev/someone that does have it
working can assist!

Cheers
David

··· On Friday, 26 May 2017 23:39:25 UTC+9:30, Bernhard Hopfenmüller wrote: > > Hey there, > > I reported a similar issue some time ago. (see my mail below) > > I can not get the Callback Plugin to work. Do you have issues there as > well, David, Philipp? If not, can I ask how you set the ansible plugin and > the callback up? > > The problem with fact importing I have as well! Foreman 1.14. > > > Hello there, > > I was hoping to get some help with the Foreman-Ansible Plugin, because I > am having a problem I cannot resolve myself. > My Foreman is Version 1.14 > I set up everything according to the instructions found on > https://theforeman.org/plugins/foreman_ansible/1.x/index.html > Additionally I ran foreman-installer -i to set up > > foreman_proxy_plugin_ansible > foreman_proxy_plugin_remote_execution_ssh > foreman_plugin_ansible > > I kickstarted a host "centos7.dev" from Foreman, that has basically only > a puppet environment and a puppet master (the foreman server itself). > I added "centos7.dev" as a trusted puppetmaster host and added an ansible > role to it. > When I am trying to run that role , the run itself works, however I get > this error on the RECAP > > PLAY RECAP ********************************************************************* > centos7.dev : ok=9 changed=0 unreachable=0 failed=0 > > [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin > ( packages/ansible/plugins/callback/foreman.CallbackModule object at 0x1753f90>): > [Errno 2] No such file or directory > > > I don't see a tab for "facts" in my host view and I have no reports > resulting from the play. > > Can anybody maybe help me with that? > > Many thanks in advance. > > > > Many thanks in advance. > On 05/26/2017 02:37 PM, Philipp Wehling wrote: > > Same here with Foreman/Katello 1.13.4 and ansible 2.3 > > Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene: >> >> Hey All, >> >> I've just installed foreman & ansible freshly on Cent OS7. >> >> Foreman works fine, I wrote a basic playbook that gathers the facts and >> copies a file in place. >> >> --- >> - name: test the ansible >> hosts: >> - foreman.levene.local >> gather_facts: yes >> tasks: >> - name: test the file >> copy: src=/tmp/aa dest=/etc/ >> >> >> This all works OK, and it creates the hosts (followed >> https://theforeman.org/plugins/foreman_ansible/1.x/index.html) >> >> PLAY [test the ansible] >> ******************************************************************************************************************************************************************************** >> >> TASK [Gathering Facts] >> ********************************************************************************************************************************************************************************* >> ok: [foreman.levene.local] >> >> TASK [test the file] >> *********************************************************************************************************************************************************************************** >> ok: [foreman.levene.local] >> >> PLAY RECAP >> ********************************************************************************************************************************************************************************************* >> foreman.levene.local : ok=2 changed=0 unreachable=0 failed >> =0 >> >> In foreman however, the host has no facts. I can see them all gathered in >> the report, but they don't seem to be correctly detected/imported into >> foreman facts. >> >> Is this a bug? or have I missed a setting somewhere? >> >> Thanks >> David >> >> >> -- > 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 foreman-user...@googlegroups.com . > To post to this group, send email to forema...@googlegroups.com > . > Visit this group at https://groups.google.com/group/foreman-users. > For more options, visit https://groups.google.com/d/optout. > > > -- > Herzliche Grüße aus München > > Bernhard Hopfenmüller > ______________________________________________________ > Dr. Bernhard Hopfenmüller > > (IT-Consultant) > > Tel: +49 (0)89 452 35 38-165 > Fax: +49 (0)89 452 35 38-290 > E-Mail: hopfen...@atix.de > XING: https://www.xing.com/profile/Bernhard_Hopfenmueller?sc_o=mxb_p > LinkedIn: https://de.linkedin.com/in/bernhard-hopfenmüller-74a83095 > > > ATIX - The Linux & Open Source Company > > ATIX Informationstechnologie und Consulting AG > Einsteinstraße 10 > 85716 Unterschleißheim > www.atix.de > > Registergericht: Amtsgericht München, Registernummer: HRB 168930 > USt.-Id.: DE209485962 > Vorstand: Thomas Merz (Vors.), Mark Hlawatschek > Vorsitzender des Aufsichtsrats: Dr. Martin Bus > >

Hi David,

thanks a lot for your reply and the issue ticket.

Mh, that looks actually pretty much like the things I did. Additionally
I was setting some values in the administrationnal section of Foreman.

However I will try with a fresh install and try to redo it.

Bests,

Bernhard

··· On 05/28/2017 08:49 AM, David LeVene wrote: > Hey, > > Firstly, i have opened an issue with foreman so it can be tracked. > > http://projects.theforeman.org/issues/19661 > > @Bernhard - I think the instructions on the foreman/ansible page > (https://theforeman.org/plugins/foreman_ansible/1.x/index.html) lack a > few things.. > > update your /etc/ansible/ansible.cfg and add in the foreman whitelist > bit |"callback_whitelist = foreman"| - as per the guide. > > 1. If you are using ansible 2.2+, then you edit this file > /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py > > And make updates like the following; > > FOREMAN_URL = os.getenv('FOREMAN_URL', "https://foreman.levene.local:443") > FOREMAN_SSL_CERT = > (os.getenv('FOREMAN_SSL_CERT',"/etc/puppetlabs/puppet/ssl/certs/foreman.levene.local.pem"), > os.getenv('FOREMAN_SSL_KEY',"/etc/puppetlabs/puppet/ssl/private_keys/foreman.levene.local.pem")) > FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY', > "/etc/puppetlabs/puppet/ssl/certs/ca.pem") <-- You can set this to 0 > or set it to your CA's path. > > I didn't have it working initially, but did a full reboot of my test > machine and it started working.. probably just need to restart foreman > or something similar (https is via passenger) > > I tested via a basic playbook and seemed to get more feedback. > > As for getting playbooks in foreman its worth noting > * foreman reads roles from /etc/ansible/roles folder - i created a > simple one in there and was able to tell foreman to run it after > importing. > * You can then assign ansible roles to hosts after importing, and run. > > Hope this helps you out a bit & I hope a dev/someone that does have it > working can assist! > > Cheers > David > > > On Friday, 26 May 2017 23:39:25 UTC+9:30, Bernhard Hopfenmüller wrote: > > Hey there, > > I reported a similar issue some time ago. (see my mail below) > > I can not get the Callback Plugin to work. Do you have issues > there as well, David, Philipp? If not, can I ask how you set the > ansible plugin and the callback up? > > The problem with fact importing I have as well! Foreman 1.14. > > >> Hello there, >> >> I was hoping to get some help with the Foreman-Ansible Plugin, >> because I am having a problem I cannot resolve myself. >> >> My Foreman is Version 1.14 >> I set up everything according to the instructions found on >> https://theforeman.org/plugins/foreman_ansible/1.x/index.html >> >> Additionally I ran foreman-installer -i to set up >> foreman_proxy_plugin_ansible >> foreman_proxy_plugin_remote_execution_ssh >> foreman_plugin_ansible >> I kickstarted a host "centos7.dev" from Foreman, that has >> basically only a puppet environment and a puppet master (the >> foreman server itself). >> I added "centos7.dev" as a trusted puppetmaster host and added an >> ansible role to it. >> When I am trying to run that role , the run itself works, however >> I get this error on the RECAP >> >> PLAY RECAP ********************************************************************* >> centos7.dev : ok=9 changed=0 unreachable=0 failed=0 >> >> [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin >> (> packages/ansible/plugins/callback/foreman.CallbackModule object at 0x1753f90>): >> [Errno 2] No such file or directory >> >> I don't see a tab for "facts" in my host view and I have no >> reports resulting from the play. >> >> Can anybody maybe help me with that? >> >> Many thanks in advance. > > > Many thanks in advance. > On 05/26/2017 02:37 PM, Philipp Wehling wrote: >> Same here with Foreman/Katello 1.13.4 and ansible 2.3 >> >> Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene: >> >> Hey All, >> >> I've just installed foreman & ansible freshly on Cent OS7. >> >> Foreman works fine, I wrote a basic playbook that gathers the >> facts and copies a file in place. >> >> > >> --- >> -name:test the ansible >> hosts: >> -foreman.levene.local >> gather_facts:yes >> tasks: >> -name:test the file >> copy:src=/tmp/aa dest=/etc/ >> > >> >> >> This all works OK, and it creates the hosts (followed >> https://theforeman.org/plugins/foreman_ansible/1.x/index.html >> ) >> >> > >> PLAY [test the >> ansible]******************************************************************************************************************************************************************************** >> >> TASK >> [GatheringFacts]********************************************************************************************************************************************************************************* >> ok:[foreman.levene.local] >> >> TASK [test the >> file]*********************************************************************************************************************************************************************************** >> ok:[foreman.levene.local] >> >> PLAY RECAP >> ********************************************************************************************************************************************************************************************* >> foreman.levene.local:ok=2 changed=0 unreachable=0 failed=0 >> > >> >> In foreman however, the host has no facts. I can see them all >> gathered in the report, but they don't seem to be correctly >> detected/imported into foreman facts. >> >> Is this a bug? or have I missed a setting somewhere? >> >> Thanks >> David >> >> >> -- >> 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 foreman-user...@googlegroups.com . >> To post to this group, send email to forema...@googlegroups.com >> . >> Visit this group at https://groups.google.com/group/foreman-users >> . >> For more options, visit https://groups.google.com/d/optout >> . >

Have you guys resolved this ?

If not, i did somethings to make it work as i am using ansible-pull and
only facts and reports are posted to foreman.

I'll be happy to share if someone is still trying to figure it out.

··· On Monday, May 29, 2017 at 3:16:28 AM UTC-4, Bernhard Hopfenmüller wrote: > > Hi David, > > thanks a lot for your reply and the issue ticket. > > Mh, that looks actually pretty much like the things I did. Additionally I > was setting some values in the administrationnal section of Foreman. > > However I will try with a fresh install and try to redo it. > > Bests, > > Bernhard > > On 05/28/2017 08:49 AM, David LeVene wrote: > > Hey, > > Firstly, i have opened an issue with foreman so it can be tracked. > > http://projects.theforeman.org/issues/19661 > > @Bernhard - I think the instructions on the foreman/ansible page ( > https://theforeman.org/plugins/foreman_ansible/1.x/index.html) lack a few > things.. > > update your /etc/ansible/ansible.cfg and add in the foreman whitelist bit "callback_whitelist > = foreman" - as per the guide. > > 1. If you are using ansible 2.2+, then you edit this file > /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py > > And make updates like the following; > > FOREMAN_URL = os.getenv('FOREMAN_URL', "https://foreman.levene.local:443" > ) > FOREMAN_SSL_CERT = > (os.getenv('FOREMAN_SSL_CERT',"/etc/puppetlabs/puppet/ssl/certs/foreman.levene.local.pem"), > > os.getenv('FOREMAN_SSL_KEY',"/etc/puppetlabs/puppet/ssl/private_keys/foreman.levene.local.pem")) > FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY', > "/etc/puppetlabs/puppet/ssl/certs/ca.pem") <-- You can set this to 0 or > set it to your CA's path. > > I didn't have it working initially, but did a full reboot of my test > machine and it started working.. probably just need to restart foreman or > something similar (https is via passenger) > > I tested via a basic playbook and seemed to get more feedback. > > As for getting playbooks in foreman its worth noting > * foreman reads roles from /etc/ansible/roles folder - i created a simple > one in there and was able to tell foreman to run it after importing. > * You can then assign ansible roles to hosts after importing, and run. > > Hope this helps you out a bit & I hope a dev/someone that does have it > working can assist! > > Cheers > David > > > On Friday, 26 May 2017 23:39:25 UTC+9:30, Bernhard Hopfenmüller wrote: >> >> Hey there, >> >> I reported a similar issue some time ago. (see my mail below) >> >> I can not get the Callback Plugin to work. Do you have issues there as >> well, David, Philipp? If not, can I ask how you set the ansible plugin and >> the callback up? >> >> The problem with fact importing I have as well! Foreman 1.14. >> >> >> Hello there, >> >> I was hoping to get some help with the Foreman-Ansible Plugin, because I >> am having a problem I cannot resolve myself. >> My Foreman is Version 1.14 >> I set up everything according to the instructions found on >> https://theforeman.org/plugins/foreman_ansible/1.x/index.html >> Additionally I ran foreman-installer -i to set up >> >> foreman_proxy_plugin_ansible >> foreman_proxy_plugin_remote_execution_ssh >> foreman_plugin_ansible >> >> I kickstarted a host "centos7.dev" from Foreman, that has basically only >> a puppet environment and a puppet master (the foreman server itself). >> I added "centos7.dev" as a trusted puppetmaster host and added an >> ansible role to it. >> When I am trying to run that role , the run itself works, however I get >> this error on the RECAP >> >> PLAY RECAP ********************************************************************* >> centos7.dev : ok=9 changed=0 unreachable=0 failed=0 >> >> [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin >> (> packages/ansible/plugins/callback/foreman.CallbackModule object at 0x1753f90>): >> [Errno 2] No such file or directory >> >> >> I don't see a tab for "facts" in my host view and I have no reports >> resulting from the play. >> >> Can anybody maybe help me with that? >> >> Many thanks in advance. >> >> >> >> Many thanks in advance. >> On 05/26/2017 02:37 PM, Philipp Wehling wrote: >> >> Same here with Foreman/Katello 1.13.4 and ansible 2.3 >> >> Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene: >>> >>> Hey All, >>> >>> I've just installed foreman & ansible freshly on Cent OS7. >>> >>> Foreman works fine, I wrote a basic playbook that gathers the facts and >>> copies a file in place. >>> >>> --- >>> - name: test the ansible >>> hosts: >>> - foreman.levene.local >>> gather_facts: yes >>> tasks: >>> - name: test the file >>> copy: src=/tmp/aa dest=/etc/ >>> >>> >>> This all works OK, and it creates the hosts (followed >>> https://theforeman.org/plugins/foreman_ansible/1.x/index.html) >>> >>> PLAY [test the ansible] >>> ******************************************************************************************************************************************************************************** >>> >>> TASK [Gathering Facts] >>> ********************************************************************************************************************************************************************************* >>> ok: [foreman.levene.local] >>> >>> TASK [test the file] >>> *********************************************************************************************************************************************************************************** >>> ok: [foreman.levene.local] >>> >>> PLAY RECAP >>> ********************************************************************************************************************************************************************************************* >>> foreman.levene.local : ok=2 changed=0 unreachable=0 >>> failed=0 >>> >>> In foreman however, the host has no facts. I can see them all gathered >>> in the report, but they don't seem to be correctly detected/imported into >>> foreman facts. >>> >>> Is this a bug? or have I missed a setting somewhere? >>> >>> Thanks >>> David >>> >>> >>> -- >> 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 foreman-user...@googlegroups.com. >> To post to this group, send email to forema...@googlegroups.com. >> Visit this group at https://groups.google.com/group/foreman-users. >> For more options, visit https://groups.google.com/d/optout. >> >> >

Hey,

No, i haven't had time to look into it correctly - if there another method,
perhaps it should be documented on

https://theforeman.org/plugins/foreman_ansible/1.x/index.html

and would be good to share it here for future ref.

Cheers
David

··· On 26 June 2017 at 12:39, Pankaj Agarwal wrote:

Have you guys resolved this ?

If not, i did somethings to make it work as i am using ansible-pull and
only facts and reports are posted to foreman.

I’ll be happy to share if someone is still trying to figure it out.

On Monday, May 29, 2017 at 3:16:28 AM UTC-4, Bernhard Hopfenmüller wrote:

Hi David,

thanks a lot for your reply and the issue ticket.

Mh, that looks actually pretty much like the things I did. Additionally I
was setting some values in the administrationnal section of Foreman.

However I will try with a fresh install and try to redo it.

Bests,

Bernhard

On 05/28/2017 08:49 AM, David LeVene wrote:

Hey,

Firstly, i have opened an issue with foreman so it can be tracked.

Bug #19661: facts are not being imported into foreman from ansible playbook run (host & reports work OK) - Ansible - Foreman

@Bernhard - I think the instructions on the foreman/ansible page (
Foreman :: Plugin Manuals) lack a
few things…

update your /etc/ansible/ansible.cfg and add in the foreman whitelist
bit “callback_whitelist = foreman” - as per the guide.

  1. If you are using ansible 2.2+, then you edit this file
    /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py

And make updates like the following;

FOREMAN_URL = os.getenv(‘FOREMAN_URL’, “https://foreman.levene.local:443"
https://foreman.levene.local:443)
FOREMAN_SSL_CERT = (os.getenv(‘FOREMAN_SSL_CERT’,
”/etc/puppetlabs/puppet/ssl/certs/foreman.levene.local.pem"),
os.getenv(‘FOREMAN_SSL_KEY’,"/etc/puppetlabs/puppet/ssl/priv
ate_keys/foreman.levene.local.pem"))
FOREMAN_SSL_VERIFY = os.getenv(‘FOREMAN_SSL_VERIFY’,
"/etc/puppetlabs/puppet/ssl/certs/ca.pem") <-- You can set this to 0 or
set it to your CA’s path.

I didn’t have it working initially, but did a full reboot of my test
machine and it started working… probably just need to restart foreman or
something similar (https is via passenger)

I tested via a basic playbook and seemed to get more feedback.

As for getting playbooks in foreman its worth noting

  • foreman reads roles from /etc/ansible/roles folder - i created a simple
    one in there and was able to tell foreman to run it after importing.
  • You can then assign ansible roles to hosts after importing, and run.

Hope this helps you out a bit & I hope a dev/someone that does have it
working can assist!

Cheers
David

On Friday, 26 May 2017 23:39:25 UTC+9:30, Bernhard Hopfenmüller wrote:

Hey there,

I reported a similar issue some time ago. (see my mail below)

I can not get the Callback Plugin to work. Do you have issues there as
well, David, Philipp? If not, can I ask how you set the ansible plugin and
the callback up?

The problem with fact importing I have as well! Foreman 1.14.

Hello there,

I was hoping to get some help with the Foreman-Ansible Plugin, because I
am having a problem I cannot resolve myself.
My Foreman is Version 1.14
I set up everything according to the instructions found on
Foreman :: Plugin Manuals
Additionally I ran foreman-installer -i to set up

foreman_proxy_plugin_ansible
foreman_proxy_plugin_remote_execution_ssh
foreman_plugin_ansible

I kickstarted a host “centos7.dev” from Foreman, that has basically
only a puppet environment and a puppet master (the foreman server itself).
I added “centos7.dev” as a trusted puppetmaster host and added an
ansible role to it.
When I am trying to run that role , the run itself works, however I get
this error on the RECAP

PLAY RECAP *********************************************************************
centos7.dev : ok=9 changed=0 unreachable=0 failed=0

[WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin
(</usr/lib/python2.7/site-
packages/ansible/plugins/callback/foreman.CallbackModule object at 0x1753f90>):
[Errno 2] No such file or directory

I don’t see a tab for “facts” in my host view and I have no reports
resulting from the play.

Can anybody maybe help me with that?

Many thanks in advance.

Many thanks in advance.
On 05/26/2017 02:37 PM, Philipp Wehling wrote:

Same here with Foreman/Katello 1.13.4 and ansible 2.3

Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene:

Hey All,

I’ve just installed foreman & ansible freshly on Cent OS7.

Foreman works fine, I wrote a basic playbook that gathers the facts and
copies a file in place.


  • name: test the ansible
    hosts:
    • foreman.levene.local
      gather_facts: yes
      tasks:
    • name: test the file
      copy: src=/tmp/aa dest=/etc/

This all works OK, and it creates the hosts (followed
Foreman :: Plugin Manuals)

PLAY [test the ansible] ******************************




TASK [Gathering Facts] ******************************




ok: [foreman.levene.local]

TASK [test the file] ******************************




ok: [foreman.levene.local]

PLAY RECAP ************************************************************



foreman.levene.local : ok=2 changed=0 unreachable=0
failed=0

In foreman however, the host has no facts. I can see them all gathered
in the report, but they don’t seem to be correctly detected/imported into
foreman facts.

Is this a bug? or have I missed a setting somewhere?

Thanks
David


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 foreman-user...@googlegroups.com.
To post to this group, send email to forema...@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “Foreman users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/foreman-users/A1M2TRXtfkw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Well, I managed to run playbooks, but still no facts and reports.

Would you mind sharing your additional steps?

Bests,

Bernhard

··· On 06/26/2017 05:09 AM, Pankaj Agarwal wrote: > Have you guys resolved this ? > > If not, i did somethings to make it work as i am using ansible-pull > and only facts and reports are posted to foreman. > > I'll be happy to share if someone is still trying to figure it out. > > On Monday, May 29, 2017 at 3:16:28 AM UTC-4, Bernhard Hopfenmüller wrote: > > Hi David, > > thanks a lot for your reply and the issue ticket. > > Mh, that looks actually pretty much like the things I did. > Additionally I was setting some values in the administrationnal > section of Foreman. > > However I will try with a fresh install and try to redo it. > > Bests, > > Bernhard > > > On 05/28/2017 08:49 AM, David LeVene wrote: >> Hey, >> >> Firstly, i have opened an issue with foreman so it can be tracked. >> >> http://projects.theforeman.org/issues/19661 >> >> >> @Bernhard - I think the instructions on the foreman/ansible page >> (https://theforeman.org/plugins/foreman_ansible/1.x/index.html >> ) >> lack a few things.. >> >> update your /etc/ansible/ansible.cfg and add in the foreman >> whitelist bit |"callback_whitelist = foreman"| - as per the guide. >> >> 1. If you are using ansible 2.2+, then you edit this file >> /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py >> >> And make updates like the following; >> >> FOREMAN_URL = os.getenv('FOREMAN_URL', >> "https://foreman.levene.local:443" >> ) >> FOREMAN_SSL_CERT = >> (os.getenv('FOREMAN_SSL_CERT',"/etc/puppetlabs/puppet/ssl/certs/foreman.levene.local.pem"), >> os.getenv('FOREMAN_SSL_KEY',"/etc/puppetlabs/puppet/ssl/private_keys/foreman.levene.local.pem")) >> FOREMAN_SSL_VERIFY = os.getenv('FOREMAN_SSL_VERIFY', >> "/etc/puppetlabs/puppet/ssl/certs/ca.pem") <-- You can set this >> to 0 or set it to your CA's path. >> >> I didn't have it working initially, but did a full reboot of my >> test machine and it started working.. probably just need to >> restart foreman or something similar (https is via passenger) >> >> I tested via a basic playbook and seemed to get more feedback. >> >> As for getting playbooks in foreman its worth noting >> * foreman reads roles from /etc/ansible/roles folder - i created >> a simple one in there and was able to tell foreman to run it >> after importing. >> * You can then assign ansible roles to hosts after importing, and >> run. >> >> Hope this helps you out a bit & I hope a dev/someone that does >> have it working can assist! >> >> Cheers >> David >> >> >> On Friday, 26 May 2017 23:39:25 UTC+9:30, Bernhard Hopfenmüller >> wrote: >> >> Hey there, >> >> I reported a similar issue some time ago. (see my mail below) >> >> I can not get the Callback Plugin to work. Do you have issues >> there as well, David, Philipp? If not, can I ask how you set >> the ansible plugin and the callback up? >> >> The problem with fact importing I have as well! Foreman 1.14. >> >> >>> Hello there, >>> >>> I was hoping to get some help with the Foreman-Ansible >>> Plugin, because I am having a problem I cannot resolve myself. >>> >>> My Foreman is Version 1.14 >>> I set up everything according to the instructions found on >>> https://theforeman.org/plugins/foreman_ansible/1.x/index.html >>> >>> Additionally I ran foreman-installer -i to set up >>> foreman_proxy_plugin_ansible >>> foreman_proxy_plugin_remote_execution_ssh >>> foreman_plugin_ansible >>> I kickstarted a host "centos7.dev" from Foreman, that has >>> basically only a puppet environment and a puppet master (the >>> foreman server itself). >>> I added "centos7.dev" as a trusted puppetmaster host and >>> added an ansible role to it. >>> When I am trying to run that role , the run itself works, >>> however I get this error on the RECAP >>> >>> PLAY RECAP ********************************************************************* >>> centos7.dev : ok=9 changed=0 unreachable=0 failed=0 >>> >>> [WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin >>> (>> packages/ansible/plugins/callback/foreman.CallbackModule object at 0x1753f90>): >>> [Errno 2] No such file or directory >>> >>> I don't see a tab for "facts" in my host view and I have no >>> reports resulting from the play. >>> >>> Can anybody maybe help me with that? >>> >>> Many thanks in advance. >> >> >> Many thanks in advance. >> On 05/26/2017 02:37 PM, Philipp Wehling wrote: >>> Same here with Foreman/Katello 1.13.4 and ansible 2.3 >>> >>> Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene: >>> >>> Hey All, >>> >>> I've just installed foreman & ansible freshly on Cent OS7. >>> >>> Foreman works fine, I wrote a basic playbook that >>> gathers the facts and copies a file in place. >>> >>> > >>> --- >>> -name:test the ansible >>> hosts: >>> -foreman.levene.local >>> gather_facts:yes >>> tasks: >>> -name:test the file >>> copy:src=/tmp/aa dest=/etc/ >>> > >>> >>> >>> This all works OK, and it creates the hosts (followed >>> https://theforeman.org/plugins/foreman_ansible/1.x/index.html >>> ) >>> >>> > >>> PLAY [test the >>> ansible]******************************************************************************************************************************************************************************** >>> >>> TASK >>> [GatheringFacts]********************************************************************************************************************************************************************************* >>> ok:[foreman.levene.local] >>> >>> TASK [test the >>> file]*********************************************************************************************************************************************************************************** >>> ok:[foreman.levene.local] >>> >>> PLAY RECAP >>> ********************************************************************************************************************************************************************************************* >>> foreman.levene.local:ok=2 changed=0 unreachable=0 >>> failed=0 >>> > >>> >>> In foreman however, the host has no facts. I can see >>> them all gathered in the report, but they don't seem to >>> be correctly detected/imported into foreman facts. >>> >>> Is this a bug? or have I missed a setting somewhere? >>> >>> Thanks >>> David >>> >>> >>> -- >>> 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 foreman-user...@googlegroups.com. >>> To post to this group, send email to forema...@googlegroups.com. >>> Visit this group at >>> https://groups.google.com/group/foreman-users >>> . >>> For more options, visit https://groups.google.com/d/optout >>> . >> >

Bernhard,

Sorry for the delayed response.

Details are mentioned here along with the copy of callback plugin file …
https://github.com/pankajagarwal/foreman_ansible

Feel free to reach me with questions if any.

thanks,

Pankaj

··· On Wed, Jun 28, 2017 at 12:41 PM, Bernhard Hopfenmüller < hopfenmueller@atix.de> wrote:

Well, I managed to run playbooks, but still no facts and reports.

Would you mind sharing your additional steps?

Bests,

Bernhard

On 06/26/2017 05:09 AM, Pankaj Agarwal wrote:

Have you guys resolved this ?

If not, i did somethings to make it work as i am using ansible-pull and
only facts and reports are posted to foreman.

I’ll be happy to share if someone is still trying to figure it out.

On Monday, May 29, 2017 at 3:16:28 AM UTC-4, Bernhard Hopfenmüller wrote:

Hi David,

thanks a lot for your reply and the issue ticket.

Mh, that looks actually pretty much like the things I did. Additionally I
was setting some values in the administrationnal section of Foreman.

However I will try with a fresh install and try to redo it.

Bests,

Bernhard

On 05/28/2017 08:49 AM, David LeVene wrote:

Hey,

Firstly, i have opened an issue with foreman so it can be tracked.

http://projects.theforeman.org/issues/19661

@Bernhard - I think the instructions on the foreman/ansible page (
Foreman :: Plugin Manuals) lack a
few things…

update your /etc/ansible/ansible.cfg and add in the foreman whitelist
bit “callback_whitelist = foreman” - as per the guide.

  1. If you are using ansible 2.2+, then you edit this file
    /usr/lib/python2.7/site-packages/ansible/plugins/callback/foreman.py

And make updates like the following;

FOREMAN_URL = os.getenv(‘FOREMAN_URL’, “https://foreman.levene.local:443
https://foreman.levene.local:443)
FOREMAN_SSL_CERT = (os.getenv(‘FOREMAN_SSL_CERT’,
“/etc/puppetlabs/puppet/ssl/certs/foreman.levene.local.pem”),
os.getenv(‘FOREMAN_SSL_KEY’,"/etc/puppetlabs/puppet/ssl/priv
ate_keys/foreman.levene.local.pem"))
FOREMAN_SSL_VERIFY = os.getenv(‘FOREMAN_SSL_VERIFY’,
“/etc/puppetlabs/puppet/ssl/certs/ca.pem”) <-- You can set this to 0 or
set it to your CA’s path.

I didn’t have it working initially, but did a full reboot of my test
machine and it started working… probably just need to restart foreman or
something similar (https is via passenger)

I tested via a basic playbook and seemed to get more feedback.

As for getting playbooks in foreman its worth noting

  • foreman reads roles from /etc/ansible/roles folder - i created a simple
    one in there and was able to tell foreman to run it after importing.
  • You can then assign ansible roles to hosts after importing, and run.

Hope this helps you out a bit & I hope a dev/someone that does have it
working can assist!

Cheers
David

On Friday, 26 May 2017 23:39:25 UTC+9:30, Bernhard Hopfenmüller wrote:

Hey there,

I reported a similar issue some time ago. (see my mail below)

I can not get the Callback Plugin to work. Do you have issues there as
well, David, Philipp? If not, can I ask how you set the ansible plugin and
the callback up?

The problem with fact importing I have as well! Foreman 1.14.

Hello there,

I was hoping to get some help with the Foreman-Ansible Plugin, because I
am having a problem I cannot resolve myself.
My Foreman is Version 1.14
I set up everything according to the instructions found on
Foreman :: Plugin Manuals
Additionally I ran foreman-installer -i to set up

foreman_proxy_plugin_ansible
foreman_proxy_plugin_remote_execution_ssh
foreman_plugin_ansible

I kickstarted a host “centos7.dev” from Foreman, that has basically
only a puppet environment and a puppet master (the foreman server itself).
I added “centos7.dev” as a trusted puppetmaster host and added an
ansible role to it.
When I am trying to run that role , the run itself works, however I get
this error on the RECAP

PLAY RECAP *********************************************************************
centos7.dev : ok=9 changed=0 unreachable=0 failed=0

[WARNING]: Failure using method (v2_playbook_on_stats) in callback plugin
(</usr/lib/python2.7/site-
packages/ansible/plugins/callback/foreman.CallbackModule object at 0x1753f90>):
[Errno 2] No such file or directory

I don’t see a tab for “facts” in my host view and I have no reports
resulting from the play.

Can anybody maybe help me with that?

Many thanks in advance.

Many thanks in advance.
On 05/26/2017 02:37 PM, Philipp Wehling wrote:

Same here with Foreman/Katello 1.13.4 and ansible 2.3

Am Dienstag, 23. Mai 2017 09:43:01 UTC+2 schrieb David LeVene:

Hey All,

I’ve just installed foreman & ansible freshly on Cent OS7.

Foreman works fine, I wrote a basic playbook that gathers the facts and
copies a file in place.


  • name: test the ansible
    hosts:
    • foreman.levene.local
      gather_facts: yes
      tasks:
    • name: test the file
      copy: src=/tmp/aa dest=/etc/

This all works OK, and it creates the hosts (followed
Foreman :: Plugin Manuals)

PLAY [test the ansible] ******************************




TASK [Gathering Facts] ******************************




ok: [foreman.levene.local]

TASK [test the file] ******************************




ok: [foreman.levene.local]

PLAY RECAP ************************************************************



foreman.levene.local : ok=2 changed=0 unreachable=0
failed=0

In foreman however, the host has no facts. I can see them all gathered
in the report, but they don’t seem to be correctly detected/imported into
foreman facts.

Is this a bug? or have I missed a setting somewhere?

Thanks
David


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 foreman-user...@googlegroups.com.
To post to this group, send email to forema...@googlegroups.com.
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.