-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathscript.py
More file actions
19 lines (16 loc) · 877 Bytes
/
script.py
File metadata and controls
19 lines (16 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os,subprocess
os.system("sudo pip3 install ansible boto3 boto")
os.system("sudo mkdir /etc/ansible")
os.system("sudo mv ec2.py ec2.ini ansible.cfg hosts /etc/ansible/")
os.system("sudo chmod +x /etc/ansible/ec2.py")
os.system("sudo chmod +x /etc/ansible/ec2.ini")
operating_system = subprocess.getoutput('hostnamectl').split('\n')[6].split(':')[1]
#print(operating_system)
if 'Redhat' in operating_system or ':Amazon' in operating_system or 'Centos' in operating_system:
os.system("sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y")
os.system("sudo yum install sshpass -y")
elif 'Ubuntu' in operating_system:
os.system("sudo apt-get update -y")
os.system("sudo apt install openssh-server -y")
os.system("sudo systemctl enable ssh")
os.system("sudo apt-get install sshpass -y")