-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpush-cert.yml
64 lines (63 loc) · 1.82 KB
/
push-cert.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Signature-based Cert Playbook
# Playbook creates a local user (Ansible) and associates a
# locally created cert with the account and also
# uses the ACI Rest module to set the domain privileges to all
#
---
# User certificate
- name: Push x509 cert and create user Ansible for signature based authentication
hosts: apic1
connection: local
gather_facts: no
tasks:
- name: Add a user
aci_aaa_user:
hostname: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
aaa_user: ansible
aaa_password: C1sco-321
expiration: never
expires: no
email: threnzy@cisco.com
first_name: Thomas
last_name: Renzy
validate_certs: no
state: present
- name: Add a certificate to user ansible
aci_aaa_user_certificate:
use_proxy: no
hostname: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
aaa_user: ansible
certificate_name: ansible
certificate_data: "{{ lookup('file', 'ansible.crt') }}"
validate_certs: no
state: present
- name: Add admin privileges to allow Ansible user to make changes
aci_rest:
hostname: "{{ inventory_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: no
path: /api/node/mo/uni/userext/user-ansible/userdomain-all.json
method: post
content:
{"aaaUserDomain":
{"attributes":{
"name":"all",
"rn":"userdomain-all",
},
"children":[
{"aaaUserRole":
{"attributes":{
"name":"admin","privType":"writePriv",
"rn":"role-admin",
},
"children":[]
}
}
]
}
}