forked from brianehlert/ansible-nginx-controller-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx_controller_license_woRole.yaml
54 lines (48 loc) · 1.43 KB
/
nginx_controller_license_woRole.yaml
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
# ansible-playbook nginx_controller_license.yaml -i controller -e "admin_email=user@company.com admin_password=userPassword"
# ansible-playbook nginx_controller_license.yaml -e "@nginx_install_controller_vars.yaml"
- hosts: controller
remote_user: ubuntu
become: true
become_method: sudo
gather_facts: yes
vars:
# base64 encoded, one line, no line endings or carrage returns
license: "{{ lookup('file', 'license/controller_license.base64.txt') }}"
tasks:
- name: login to Controller
uri:
url: "https://{{fqdn}}/api/v1/platform/login"
method: "POST"
body:
credentials:
type: "BASIC"
username: "{{admin_email}}"
password: "{{admin_password}}"
body_format: json
return_content: yes
status_code: 204
validate_certs: false
register: auth
- name: POST controller license
uri:
url: "https://{{fqdn}}/api/v1/platform/license-file"
method: POST
body:
content: "{{ license }}"
body_format: json
return_content: yes
status_code: 200
validate_certs: false
headers:
Cookie: "{{auth.set_cookie}}"
register: controller_response
- name: GET controller license status
uri:
url: "https://{{fqdn}}/api/v1/platform/license"
method: GET
status_code: 200
validate_certs: false
headers:
Cookie: "{{auth.set_cookie}}"
register: controller_license