Ansible : with call api and his token

hi

our team try MAAS solution .

We would like to manage MAAS by ansible and some call API .

But we don t find any way/solution to configure uri modul from Ansible …

uri:
url: “http://xxx.xxx.xxx.xxx:5240/MAAS/api/2.0/machines/xxxxx/

       consumer_key: "xxxxxx"
       token_key: "xxxxxx"
      token_secret: "xxxxxx"

how to défine the module with the token ???
hearders description ?

all kind of solution give 401 .

we try with libmass too and our token work( with api call)

Anyone can help ??
thanks

it wasn t a high level question, but perhaps it could help someone .

we fund a way so :

with you api key from MAAS : oauth_consumer_key : oauth_token : oauth_signature

ansible task :
uri:
url: “http://xxx.xxx.xxx.xxx:5240/MAAS/api/2.0/machines/
method: GET
headers:
Authorization: OAuth oauth_consumer_key=“xxxxxxx”,oauth_token=“xxxxx”,oauth_signature_method=“PLAINTEXT”,oauth_timestamp=“1952448470”,oauth_nonce=“pouic”,oauth_version=“1.0”,oauth_signature="%26xxxxxxxx"
Content-Type: “application/json”
Accept: “application/json”
use_proxy: no

oauth_timestamp >>> need to be diferent at each call , unix format
oauth_nonce >>> put what you want
oauth_signature >>> %26 is need cause of the method : plaintext

hope it helps someone one day )))

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.