-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathansible-runplaybook.py
More file actions
29 lines (20 loc) · 886 Bytes
/
ansible-runplaybook.py
File metadata and controls
29 lines (20 loc) · 886 Bytes
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
import os
ls_ansible = 'ls /mnt/c/Users/GioCotto/python_scripts'
os.system(ls_ansible)
print('The playbooks in the directory are listed above...\n')
path = '/mnt/c/Users/GioCotto/python_scripts'
run_ansible_while = True
while run_ansible_while == True:
input_playbook = input('Enter the playbook to run:\n')
run_ansible = f'ansible-playbook {path}/{input_playbook} --ask-become-pass'
os.system(run_ansible)
second_input = input('Need to run another playbook?\nEnter "Y" or "N":\n').upper()
if second_input == 'Y':
os.system(ls_ansible)
input_playbook_two = input('Enter the playbook to run:\n')
run_ansible_two = f'ansible-playbook {path}/{input_playbook_two} --ask-become-pass'
os.system(run_ansible_two)
run_ansible_while = False
if second_input == 'N':
run_ansible_while = False
print('Script has finished')