Package: atkinsonm-configurator
ConfiguratorWelcome to the Configurator! Configurator is a Python-based command line interface (CLI) which issues commands based on user-defined "tasks" to "hosts" over SSH.InstallationOption 1: Install from TestPyPIInstall the configurator:pip install atkinsonm-configuratorOption 2: Install from SourceClone this package.cd part-two.sudo python3 setup.py.Runatkinsonm-configurator --helpto confirm the install.Using the Configuratoratkinsonm-configurator --helpis your friend.Configuring Hostsatkinsonm-configurator host --helplists commands for managing hosts. You can also manage the hosts file by hand. Seesamples/hosts.yamlfor examples.At this time we support password authentication only and assume the password is for the root user. We only support specifying hosts by IP address at this time.The hosts must have a root user, must allow logins to the root user using password authentication, and must be accessible over SSH. No other dependencies are required for installation on target hosts (and therefore nobootstrap.shis provided with this package).Configuring TasksModify the hosts file (YAML format, default location/home/$USER/configurator-tasks.yaml) by hand using the supported task types below. The format of the file is a top-level key calledtaskswhich is a list of task definitions.Seesamples/tasks.yamlfor examples.Tasks are executed in the order they are defined. Define related task dependencies before successors.Shared PropertiesAll tasks have these properties.name: strTasks which support specifying a service to restart have these additional properties:restart_service (str): the name of a service to restart withservice <service-name> restartSupported Task TypesFileCreate files, set content and metadataThis will replace any files/contents already present at specified locations. Use with caution.type: filepath (str): absolute path or relative path (from the root user's home directory) of the file to createcontents (str): the file contentsowner (str) the file owner (user)group (str) the file owner (group)mode (int) the file modetasks:-name:hellotype:filepath:/root/hellocontents:hello!owner:rootgroup:rootmode:644Escape single quotes in contents.File RemoveRemoves a file at the specified path.type: file_removepath (str): absolute path or relative path (from the root user's home directory) of the file to remove-name:remove default indextype:file_removepath:/var/www/html/index.htmlPackageInstalls and uninstalls packages (apt support only)type: packageinstall (bool):TrueorFalse.Truemeans install,Falsemeans uninstallpackage_name (str): the name of the packageRunning CommandsUseatkinsonm-configurator task runto run all tasks on all hosts in sequence.Configuring an Ubuntu Server with Apache and PHPsamples/webserver-tasks.yamlhas tasks to set up an Ubuntu server to install Apache and PHP and run a Hello World program in PHP. To run it:Installatkinsonm-configurator(command above)Copy the contents ofsamples/webserver-tasks.yamlto a local file (e.g./home/$USER/webserver-config.yaml)Configure hosts per instructions above (hosts file not included here for security reasons)Runatkinsonm-configurator task run -t /home/$USER/webserver-config.yamlTest your new webserver withcurl -sv "http://ADDRESS"Future ImprovementsThere are a number of improvements I would make to this application given more time. Many TODOs are called out in code comments. I will highlight a few significant ones here:Support authentication other than root userPrivilege escalation (sudo) where necessary for non-root usersSSH key-based authenticationSupport for other package managersGeneral code cleanliness