Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def start_provision():
- """
- Start server provisioning
- """
- # Create a new directory for a new remote server
- env.ssh_keys_name = os.path.join(
- env.ssh_keys_dir, env.host_string + '_prod_key')
- local('ssh-keygen -t rsa -b 2048 -f {0}'.format(env.ssh_keys_name))
- local('cp {0} {1}/authorized_keys'.format(
- env.ssh_keys_name + '.pub', env.ssh_keys_dir))
- # Prevent root SSHing into the remote server
- sed('/etc/ssh/sshd_config', '^UsePAM yes', 'UsePAM no')
- sed('/etc/ssh/sshd_config', '^PermitRootLogin yes',
- 'PermitRootLogin no')
- sed('/etc/ssh/sshd_config', '^#PasswordAuthentication yes',
- 'PasswordAuthentication no')
- install_ansible_dependencies()
- create_deployer_group()
- create_deployer_user()
- upload_keys()
- set_selinux_permissive()
- run('service sshd reload')
- upgrade_server()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement