This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Installing postfix | |
hosts: localhost | |
sudo: yes | |
tasks: | |
- name: Set Postfix option hostname | |
debconf: name=postifx question="postfix/mailname" value="{{ansible_fqdn}}" vtype="string" | |
- name: Set Postfix option type as internet site |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Fixing some security issues in Ubuntu instance | |
sudo: yes | |
hosts: x.x.x.x | |
vars: | |
ubuntu_common_ssh_port: 3992 | |
ubuntu_common_required_packages: | |
- ufw | |
- fail2ban | |
- unattended-upgrades |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
tasks: | |
- ec2_vpc: | |
state: present | |
cidr_block: 10.3.0.0/16 | |
resource_tags: { "Environment":"Development" } | |
region: ap-northeast-1 | |
state: present | |
instance_tenancy: dedicated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: 172.30.1.237 | |
name: Create subnet for database servers | |
tasks: | |
- name: Creating public subent | |
ec2_vpc_subnet: | |
state: present | |
cidr: 10.3.1.0/24 | |
resource_tags: { "Environment":"Dev", "Name":"public"} | |
vpc_id: vpc-6c31ac09 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: To set up internet gateway | |
hosts: all | |
tasks: | |
- name: creating vpc | |
ec2_vpc: | |
region: ap-northeast-1 | |
state: present | |
cidr_block: 20.0.0.0/16 | |
resource_tags: { "Name":"Test" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: To set up internet gateway | |
hosts: localhost | |
tasks: | |
- name: example nat group | |
ec2_group: | |
name: natsecuritygrp | |
description: an example EC2 group | |
#vpc_id: 12345 | |
region: eu-central-1 | |
ec2_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Changing ssh default port | |
lineinfile: | |
dest: /etc/ssh/sshd_config | |
regexp: '^Port\s' | |
state: present | |
line: 'Port {{ubuntu_ssh_port}}' #give the port number you want to use | |
#note we need to restart the ssh service | |
#existing ssh connection will get disconnected | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Creating new user | |
user: | |
name: <username> | |
group: <groupname> | |
state: present | |
shell: /bin/bash #default shell | |
home: <path_to_home> #example /home/username | |
#if we donot want home directory to be created,then use createhome: no | |
password: "{{ lookup('env', 'PASSWD') }}" #set the password for the user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: creating an instance in AWS using default VPC and Security Group | |
hosts: localhost | |
vars: | |
instance_info: | |
- name: "< instance name >" | |
image: "ami-835b4efa" # Ubuntu 14.04 | |
group_id: '<security-group>' | |
region: '<region-name' #us-west-2, ap-northeast-1 | |
instance_type: '< instance type >' # t2.micro, mx.xlarge etc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Creating a Volume | |
hosts: localhost | |
become: yes | |
tasks: | |
- name: Creating a Volume | |
ec2_vol: | |
aws_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}" | |
aws_secret_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}" | |
instance: '<instance-id>' |
NewerOlder