Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Detectionlab | 4,124 | a day ago | 33 | mit | HTML | |||||
Automate the creation of a lab environment complete with security tooling and logging best practices | ||||||||||
Infrastructure As Code Tutorial | 2,065 | 4 months ago | 11 | apache-2.0 | ||||||
Infrastructure As Code Tutorial. Covers Packer, Terraform, Ansible, Vagrant, Docker, Docker Compose, Kubernetes | ||||||||||
Boilerplates | 1,727 | 12 days ago | mit | HCL | ||||||
This is my personal template collection. Here you'll find templates, and configurations for various tools, and technologies. | ||||||||||
Packer Boxes | 624 | 3 months ago | 8 | mit | Shell | |||||
Jeff Geerling's Packer build configurations for Vagrant boxes. | ||||||||||
Packer Templates | 368 | a day ago | 1 | apache-2.0 | Shell | |||||
Scripts and Templates used for generating Vagrant images | ||||||||||
Multi Env Deploy | 302 | 5 months ago | 3 | apache-2.0 | HCL | |||||
Complete example of deploying complex web apps to AWS using Terraform, Ansible, and Packer | ||||||||||
Ad Honeypot Autodeploy | 217 | 6 months ago | 3 | Shell | ||||||
Deploy a small, intentionally insecure, vulnerable Windows Domain for RDP Honeypot fully automatically. | ||||||||||
Ansible Terraform | 182 | 4 years ago | 1 | HCL | ||||||
Ansible and Terraform: Better Together | ||||||||||
Ops Cli | 180 | 17 days ago | 44 | October 14, 2021 | 18 | apache-2.0 | Python | |||
Ops - cli wrapper for Terraform, Ansible, Helmfile and SSH for cloud automation | ||||||||||
Ansible Harden Windows | 150 | a month ago | 1 | bsd-2-clause | Jinja | |||||
Ansible role to harden windows system |
This project define two ways to automate the provisioning of Ubuntu servers (Refer Usage section):
All the automation files and bash scripts were tested in Ubuntu 16.04
The Ansible playbook will automate the provisioning of Ubuntu servers. It will perform following actions out of the box:
It will also install the following packages:
Project main directory structure:
.
โโโ README.md
โโโ ansible
โโโ initial-setup.sh
โโโ packer
โโโ scripts
If you use a Debian based system to provision remote Ubuntu servers, you can run initial-setup.sh
bash script to install Ansible, Packer, AWS CLI and Git to initialize the environment.
If you already installed the required software, skip to the Usage section.
Initialization bash scripts will automate the installation of Ansible, Packer, AWS CLI, Git packages and configurations.
Following are the list of initial scripts:
.
โโโ initial-setup.sh
โโโ scripts
โโโ ansible-installer.sh
โโโ awscli-installer.sh
โโโ git-installer.sh
โโโ packer-installer.sh
Options:
-a
Install Ansible and Git binaries only-c
Install Complete set of packages - Ansible, Packer, AWS CLI and Git binaries-h
helpRunning the following script without any parameters will install only the Ansible and Git binaries as the default option.
Run:
./initial-setup.sh
Following is the Ansible deployment directory structure:
.
โโโ ansible.cfg
โโโ inventory
โ โโโ group_vars
โ โ โโโ vars.yml
โ โ โโโ vault.yml
โ โโโ hosts
โโโ provision.yml
โโโ roles
โโโ common
โ โโโ tasks
โ โโโ main.yml
โโโ motd
โ โโโ tasks
โ โ โโโ main.yml
โ โโโ templates
โ โโโ motd.j2
โโโ ssh
โ โโโ handlers
โ โ โโโ main.yml
โ โโโ tasks
โ โโโ main.yml
โโโ ufw
โ โโโ tasks
โ โโโ main.yml
โโโ user
โโโ tasks
โโโ main.yml
Go to ansible
directory.
Configure the inventory/hosts
file according to your environment.
[production]
ubuntu-1 ansible_host=192.168.1.2
Edit inventory/group_vars/vars.yml
file to configure your initial ssh user, new user account, packages to be installed and local SSH public key path.
initial_user: ubuntu
username: user
password: "{{ vault_userpasswd }}"
public_key: ~/.ssh/id_rsa.pub
sys_packages: [ 'python-apt', 'base-files', 'vim', 'git-core', 'ufw' ]
Please note that the new user's password is encrypted using Ansible Vault. You can make any changes to the inventory/group_vars/vault.yml
file to edit the hashed sudo password value defined as vault_userpasswd
variable.
Current hashed
sudo
password -devopspass
You can include the vault password in inventory/group_vars/.vault_pass
as configured in ansible.cfg
to decrypt the inventory/group_vars/vault.yml
during an automation pipeline.
Current
vault
password -devopsvaultpass
Assuming that you already copied SSH public key to the remote system using
ssh-copy-id
Run:
ansible-playbook provision.yml
Following is the Packer with Ansible deployment directory structure:
.
โโโ provisioners
โ โโโ ansible
โ โ โโโ ansible.cfg
โ โ โโโ files
โ โ โ โโโ id_rsa.pub
โ โ โโโ inventory
โ โ โ โโโ group_vars
โ โ โ โ โโโ vars.yml
โ โ โ โ โโโ vault.yml
โ โ โ โโโ hosts
โ โ โโโ provision.yml
โ โ โโโ roles
โ โ โโโ common
โ โ โ โโโ tasks
โ โ โ โโโ main.yml
โ โ โโโ motd
โ โ โ โโโ tasks
โ โ โ โ โโโ main.yml
โ โ โ โโโ templates
โ โ โ โโโ motd.j2
โ โ โโโ ssh
โ โ โ โโโ handlers
โ โ โ โ โโโ main.yml
โ โ โ โโโ tasks
โ โ โ โโโ main.yml
โ โ โโโ ufw
โ โ โ โโโ tasks
โ โ โ โโโ main.yml
โ โ โโโ user
โ โ โโโ tasks
โ โ โโโ main.yml
โ โโโ scripts
โ โโโ bootstrap.sh
โโโ ubuntu-build.json
Go to packer
directory.
Edit provisioners/ansible/inventory/group_vars/vars.yml
file to configure your initial ssh user, new user account, packages to be installed and local SSH public key path. You can just copy your SSH public key to provisioners/ansible/files
directory as id_rsa.pub
.
initial_user: ubuntu
username: user
password: "{{ vault_userpasswd }}"
public_key: ../../files/id_rsa.pub
sys_packages: [ 'python-apt', 'base-files', 'vim', 'git-core', 'ufw' ]
Please note that the new user's password is encrypted using Ansible Vault. You can make any changes to the provisioners/ansible/inventory/group_vars/vault.yml
file to edit the hashed sudo password value defined as vault_userpasswd
variable.
Current hashed
sudo
password -devopspass
You can include the vault password in provisioners/ansible/inventory/group_vars/.vault_pass
as configured in provisioners/ansible/ansible.cfg
to decrypt the provisioners/ansible/inventory/group_vars/vault.yml
file during an automation pipeline.
Current
vault
password -devopsvaultpass
Change ami_name
and aws_region
parameters in ubuntu-build.json
file according to your implementation. The default values set as follows:
"ami_name": "ubuntu-16-ami"
"aws_region": "ap-southeast-2"
Please make sure to use AWS CLI tool,
aws configure
to set AWS access keys. It's recommended to avoid setting up AWS access keys inubuntu-build.json
for better security.
Run:
packer build -machine-readable ubuntu-build.json
AMI ID will be printed at the end.
Pull requests are welcome to improve the automation scripts.
Rumesh Bandara [email protected]