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
    <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
    (</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
        <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 [email protected] <javascript:>.
    To post to this group, send email to [email protected]
    <javascript:>.
    Visit this group at https://groups.google.com/group/foreman-users
    <https://groups.google.com/group/foreman-users>.
    For more options, visit https://groups.google.com/d/optout
    <https://groups.google.com/d/optout>.


--
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