Package: environmentconf
About The ProjectEnvironmentconf is a python based tool to configure remote environments. Remote environments can be remote virtual machines or Docker containers.Built WithpythonGetting StartedTo run the tool on your machine please follow these steps-Make sure you have Python 3.6 or higher installed on your machineInstallenvironmentconfusing pip. e.g.pip3 install environmentconfOnce tool is installed you are ready to use it. e.g.python3 -m environmentconf.envconf_manager --apply config_path=<valid absolute path which contains configs>ORIf you are running Ubuntu based system then use thebootstrap.shwhich is at the root of the project to perform all the steps mentioned above.PrerequisitesTool requiresPython 3.6or higher andpipto install tool.Installapt-getinstall-ypython3-pipInstallationPip installpip3installenvironmentconfUsageTool needs two configuration filesCreate a directory where we will put all the configs.Create file namedenvironments.yaml. This specifies all the environments which needs to be configured.---
group1: #group of machines
  environments:
  - ip: 1.2.3.4
    connection_type: ssh
    tags:
      - region: us-east-1
      - account_id: 123
  - ip: 1.2.3.5
    connection_type: ssh
    tags:
      - region: us-east-1
      - account_id: 123
group2: #grop of docker containers(unit testing or if remote env is composed of docker)
  environments:
  - id: e6d3a73ff6c2 #id of the docker container
    connection_type: dockerCreate file namedconfigurations.yaml. This specifies set of configurations we need to perform on target environments. For example, if we want to configure remote environment to host php using Apache web server then this is how we compose the configuration file.Note thathostsproperty targets the group defined inenvironments.yaml. You can have multiple environments inenvironments.yamlfile for which you can run different set of actions specificed inconfigurations.yaml.---
- hosts: group1
  actions:
  - name: install_apache2
    executor: package
    action: install
    args:
      name: apache2
  - name: install_libapache2-mod-php
    executor: package
    action: install
    args:
      name: libapache2-mod-php
  - name: copy_index_php
    executor: artifact
    action: copy
    args:
      source: /Users/someuser/code/index.php
      destination: /var/www/html/
  - name: delete_index_html
    executor: artifact
    action: delete
    args:
      destination: /var/www/html/index.html
  - name: Start the apache2 server
    executor: process
    action: start
    args:
      name: apache2
      subscribe:
        - install_apache2Now, we are all set to configure the remote environment (considering tool is already installed on machine). Grab the absolute path of the directory which contains the aboveyamlfiles. Runenvironmentconfusing this command-python3 -m environmentconf.envconf_manager --apply config_path=<valid absolute path which contains configs>We can also use docker to test the tool.Make sure you have Docker installed on your machine.docker pull ubuntu:18.04docker run -it ubuntu:18.04 bashCopy/Createbootstrap.shfile in docker container and then run it.You are all set! Go runpython3 -m environmentconf.envconf_manager --apply config_path=<valid absolute path which contains configs>ArchitectureRead more about tool's architecturehereLicenseDistributed under the MIT License.ContactMaulik PatelProject Link:https://github.com/maulik887/environmentconf