[foreman-users] Re: Foreman foreman_ansible plugin rest-api get ansible_roles

2017-08-29 Thread mobios


Hello Users,
>

   i swap from Foreman rest-api to directly query the Foreman database.
   It works well. 

   Regards
   mobios

-- 
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+unsubscr...@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.


[foreman-users] Re: Foreman ansible callback plugin foreman_callback.py generate duplicate hosts in foreman

2017-08-28 Thread mobios


> Hello Michael,
>>>
>>  
   thanks for your effort.
   
   regards
   mobios
   

-- 
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+unsubscr...@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.


[foreman-users] Re: reports = none and foreman out-of-sync

2017-08-28 Thread mobios


> Hello Suresh,
>

   i think  Foreman needs the reports to recognize if your client had a 
puppetrun or not.
  
   I have:
   reports = log, foreman

  Why do you not change to just
  reports = foreman
  
  In your Foreman settings you have:

  Puppet interval and Out of sync interval.

  My puppet interval are 30 min and my Out of sync interval are 5 min.
  If Foreman dont receive reports within 35 min from a host this host
  change  to OUT_OF_SYNC
 
  regards
  mobios

 

 

-- 
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+unsubscr...@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.


[foreman-users] Foreman foreman_ansible plugin rest-api get ansible_roles

2017-08-28 Thread mobios
Hello Users,


Setup:
Foreman: 1.15.3
Foreman_ansible:1.4.5
Ansible:2.0.0.2


Currently i write a dynamic inventory script for my ansible server.

I want retrieve all hosts and ansible_roles from my foreman server over
the rest api.


To get all hosts works well but i cant receive the ansible_roles. 

Url for all hosts -> https://foreman_server/api/v2/hosts (works well)

Url for ansible_roles -> https://foreman_server/api/v2/ansible/ansible_roles 
(dont work)

Errormessage:
{"Status":"404","error":"Not found"}



I knew the restapi from Foreman and wrote a lot off scripts.
https://theforeman.org/api/1.15/index.html

But i cant see any documantation for foreman_ansible plugin and restapi 
calls


Anyone an idea ?

Regards
mobios



-- 
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+unsubscr...@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.


[foreman-users] Re: Foreman ansible callback plugin foreman_callback.py generate duplicate hosts in foreman

2017-08-23 Thread mobios


Sorry i forgot the attachment. Now i added.
>

-- 
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+unsubscr...@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.


[foreman-users] Re: foreman ans ansible playbook

2017-08-23 Thread mobios
Hello,

did you set under Foreman settings/ansible the right user?
I had the same issue till i set the right username.

Regards
Mobios








Am Dienstag, 1. August 2017 10:58:13 UTC+2 schrieb Arsène Gschwind:

> Hi,
>
> I'm trying to use ansible with foreman but when tying to execute an 
> ansible playbook I get the following error:
>
> fatal: [darla-hesley.vm.sapify.ch]: UNREACHABLE! => {"changed": false, "msg": 
> "Failed to connect to the host via ssh: write: Broken pipe\r\n", 
> "unreachable": true}
>   to retry, use: --limit 
> @/tmp/foreman-playbook-9bc23404-2d9b-4c65-ad58-04a799263dc1.retry
>
> When running the playbook directly with ansible from the shell  it works 
> even when doing a sudo -u foreman-proxy.
>
> I'm not sure which user foreman is using to run playbooks, I've tried to 
> set the user in the foreman settings->ansible tab or even using the 
> parameter ansible_user on the host, neither did help.
> I'm running the following version:
> foreman : Version 1.15.2
> katello: 3.4.2
> foreman-tasks: 0.9.4
> ansible 2.3.1.0
>
> Thanks for any help
> rgds,
> Arsène
>

-- 
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+unsubscr...@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.


[foreman-users] Re: Foreman deleting host leaves certificate on puppetserver intact

2017-04-27 Thread mobios
Problem is solved. I forgot: edit host -> and then set to managed :)








-- 
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+unsubscr...@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.


[foreman-users] Foreman deleting host leaves certificate on puppetserver intact

2017-04-19 Thread mobios

Hello Foreman user,


Infos:
Puppetserver 4.10.0
Foreman: 1.14.3
Foreman-Proxy: 1.14.3


After upgrading to puppetserver 4 deleting hosts in Foreman  leaves 
certificate on puppetserver intact.


Configfiles:

/etc/foreman-proxy/Settings.d/puppetca.yml

---
# PuppetCA managment
:enabled: https
:ssldir: /etc/puppetlabs/puppet/ssl
:puppetdir: /etc/puppetlabs/puppet



/etc/foreman-proxy/settings.d/puppet.yml

:enabled: https
:puppet_version: 4.10.0




Puppetserver and Foreman are on same machine. Foreman-Proxy is running.
If i delete a host in Foreman i can see nothing in the logfile

/var/log/foreman-proxy/proxy.log

But the communication between Foreman and Foreman-Proxy are OK.

If i list all signed certificates in Foreman and look in the logfile 
/var/log/foreman-proxy/proxy.log i see

Found puppetca at /opt/puppetlabs/bin/puppet
Found sudo at /usr/bin/sudo
Executing /usr/bin/sudo -S /opt/puppetlabs/bin/puppet cert --ssldir 
/etc/puppetlabs/puppet/ssl --list --all


and in Foreman i see all signed certificates.


Any idea? Can anyone help please.


Regards
mobios









-- 
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+unsubscr...@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.


Re: [foreman-users] Foreman api v2 post filter

2016-11-15 Thread mobios
Thank for your answer Thomas.

My Problem is resolved.
I used Curl against the Restapi and i realized i need one more parameter in 
my http request.

Your ideas were very usefull.

Best regards
mobios

-- 
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+unsubscr...@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.


[foreman-users] Foreman api v2 post filter

2016-11-14 Thread mobios
*Hi All,*




*Currently i try to automate any tasks over foreman api v2.I want to create 
a usergroup, a role and any filtersI already done to create a usergroup and 
a role code snippet below.*



## Usergroup creation
usergroupurl="https://#{user}:#{password}@localhost/api/v2/usergroups;

def checkusergroup(usergroupurl, usergroup, user, password)
  restget = RestClient.get "#{usergroupurl}"
if restget.include?(usergroup)
  return true
else
  return false
end
end

def setusergroup(usergroupurl, usergroup, user, password)
  body = { :usergroup => {
:name => "#{usergroup}"
   }
  }
  response = RestClient.post("#{usergroupurl}", body.to_json, 
{:content_type => 'application/json', :accept => 'application/json'})
end

unless checkusergroup(usergroupurl, usergroup, user, password)
  setusergroup(usergroupurl, usergroup, user, password)
end


## Role creation
rolesurl="https://#{user}:#{password}@localhost/api/v2/roles;

def checkroles(rolesurl, role, user, password)
  restget = RestClient.get "#{rolesurl}"
if restget.include?(role)
  return true
else
  return false
end
end

def setrole(rolesurl, role, user, password)
  body = { :role => {
 :name => "#{role}"
   }
}
  response = RestClient.post("#{rolesurl}", body.to_json, {:content_type => 
'application/json', :accept => 'application/json'})
end

unless checkroles(rolesurl, role , user, password)
  setrole(rolesurl, role, user, password)
end



*Unfortunately i have problems to create my own filter. (code below)*


hostfilterurl="https://#{user}:#{password}@localhost/api/v2/filters/;
def sethostfilter(hostfilterurl, role, user, password)
 body = { :filter => {
:role_id => "700"
}
 }  
  response = RestClient.post("#{hostfilterurl}", body.to_json, 
{:content_type => 'application/json', :accept => 'application/json'})
end
sethostfilter(hostfilterurl, role, user, password)



*In this case i get always a errormessage.*
*Message: 422 Unprocessable Entity*



Can anybody help?

Regards
mobios


Vollständigen Inhalt anzeigen 

-- 
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+unsubscr...@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.