Git Product home page Git Product logo

configmanager's Introduction

ConfigManager

Configuration Management

This repository contains Ansible playbooks to create an ec2 instance and to do the other required steps.

The createEC2Instance.yml playbook contains all the EC2 Instance details, and also creates one. In order to use it correctly, the machine running this Ansible playbook must have python 3, ansible and boto3 installed, which are required for ec2 instances management. Also, it's required to add an user on IAM at AWS with AmazonEC2FullAccess policy and get its Access Key ID and Secret Access key to put it into .boto file, which can be found on home/{your-user}/.boto (if it doesn't exist, just create one). Your .boto file should look like this:

  • .boto file

[Credentials] aws_access_key_id = {created user aws access key id} aws_secret_access_key = {created user aws secret access key}

After that, make sure that you have amazon.aws collection installed, in order to use createEC2Instance playbook. To check whether it is installed, run ansible-galaxy collection list. If it is not installed, run ansible-galaxy collection install amazon.aws. After that, it's important to make sure that you have your ansible hosts file configurated. To check you have your hosts file configurated, use ansible all --list-hosts or ansible-inventory --list. If there are no hosts configured, you will need to create or edit the hosts file, which is located on etc/ansible/hosts. For this first step, you need to have the hosts file configured, and it can be something like this:

  • hosts file [local] localhost

[ec2]

It doesn't have to be like the example above, but the playbook will look for the tag [ec2] in order to put the newly created EC2 instance in the hosts file.

Also, you must make sure that your default security group have ssh permissions. After that, you are able to run the createEC2Instance by using the following command : ansible-playbook -K createEC2Instance.yml

Now, for the following part, we have configmanager playbook, which is responsible for

  • Copying the script nice-script.sh, that contains the command to list all mounted filesystems, to the remote machine into /etc/skel
  • Creating a user with
    • Username: john
    • Home: /better-place/john
    • User ID: 1234
  • Enables User john to run whoami command with sudo without providing his password
  • Install packages Tmux, vim, unzip(used to install Terraform) and Terraform CLI

User john have no password, so in order to change to john user after connecting to your remote machine, just use su john and it's done.

To run the configmanager playbook just run ansible-playbook configmanager.yml and type "yes" when asked for connection.

configmanager's People

Contributors

hisck avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.