-
Notifications
You must be signed in to change notification settings - Fork 0
/
aap-manage.yml
92 lines (83 loc) · 3.05 KB
/
aap-manage.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
- name: Managing AAP
hosts: localhost
gather_facts: false
vars:
# Ansible Controller (AAP) connection details
controller_host: "https://your-aap-instance.example.com"
controller_username: "admin"
controller_password: "your_admin_password"
# User details
new_user:
username: "new_automation_user"
password: "SecurePassword123!"
email: "[email protected]"
first_name: "Automation"
last_name: "User"
state: present
# Team details
new_team:
name: "Operations Team"
organization: "Default"
state: present
# Job Template details
job_template_name: "Example Deployment Template"
collections:
- ansible.controller
tasks:
- name: Create User in Ansible Controller
ansible.controller.user:
username: "{{ new_user.username }}"
password: "{{ new_user.password }}"
email: "{{ new_user.email }}"
first_name: "{{ new_user.first_name }}"
last_name: "{{ new_user.last_name }}"
state: "{{ new_user.state }}"
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: false # Set to true in production
register: user_creation_result
- name: Create Team in Ansible Controller
ansible.controller.team:
name: "{{ new_team.name }}"
organization: "{{ new_team.organization }}"
state: "{{ new_team.state }}"
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: false # Set to true in production
register: team_creation_result
- name: Launch Job Template
ansible.controller.job_launch:
job_template: "{{ job_template_name }}"
controller_host: "{{ controller_host }}"
controller_username: "{{ controller_username }}"
controller_password: "{{ controller_password }}"
validate_certs: false # Set to true in production
register: job_launch_result
- name: Display Results
debug:
msg:
- "User Creation Result: {{ user_creation_result }}"
- "Team Creation Result: {{ team_creation_result }}"
- "Job Launch Result: {{ job_launch_result }}"
# Notes for usage:
# 1. Prerequisites:
# - Install the ansible.controller collection:
# ansible-galaxy collection install ansible.controller
#
# 2. Before running, replace placeholders:
# - controller_host: Your Ansible Controller instance URL
# - controller_username: Admin username
# - controller_password: Admin password
# - Customize new_user and new_team details as needed
# - Set correct job_template_name
#
# 3. Run the playbook:
# ansible-playbook aap_management_playbook.yml
#
# 4. Security Recommendations:
# - Use Ansible Vault to encrypt sensitive information
# - Set validate_certs to true in production
# - Implement proper access controls and password policies