-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure-controller-token.yml
35 lines (34 loc) · 1.15 KB
/
configure-controller-token.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- name: Playbook for configuring token exchange
hosts: localhost
vars_files:
- eda-setup-vars.yml
vars:
token_description: EDA Controller token
tasks:
- name: Create a new token using username/password
ansible.controller.token:
description: "{{ token_description }}"
scope: "write"
state: present
controller_host: "{{ aap2_controller_url }}"
controller_username: "{{ aap2_controller_username }}"
controller_password: "{{ aap2_controller_password }}"
validate_certs: false
register: _aap2_token
- name: EDA Controller | Create token on EDA Controller
ansible.builtin.uri:
url: "{{ eda_controller_url }}/api/eda/v1/users/me/awx-tokens/"
force_basic_auth: true
url_username: "{{ eda_controller_user }}"
url_password: "{{ eda_controller_password }}"
method: POST
body:
name: "AAP Controller"
description: "EDA Controller token"
token: "{{ _aap2_token.ansible_facts.controller_token.token }}"
body_format: json
validate_certs: false
status_code:
- 200
- 201