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: local | |
connection: local | |
vars_files: | |
- /home/ansible/awscreds.yml # contains var info as mention in comment | |
tasks: | |
- name: Get DB instance name | |
shell: aws rds describe-db-instances --query DBInstances[*].DBInstanceIdentifier --region "{{ aws_region }}" --output text | tr "\t" "\n" > "{{ path }}" | |
register: rds_instances |
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: local | |
connection: local | |
gather_facts: yes | |
vars: | |
aws_region: ap-south-1 | |
aws_access_key: asfhafsfaadvadvdv | |
aws_secret_key: KVsfioefln845141cashcgaksjsdvsdv | |
tasks: | |
- name: get instance 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
root@kube01:~# kubectl get nodes | |
NAME STATUS ROLES AGE VERSION | |
kube01 Ready master,node 7m v1.8.3+coreos.0 | |
kube02 Ready master,node 7m v1.8.3+coreos.0 | |
kube03 Ready node 7m v1.8.3+coreos.0 | |
kube04 Ready node 7m v1.8.3+coreos.0 | |
root@kube01:~# kubectl get componentstatuses | |
NAME STATUS MESSAGE ERROR |
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
--- | |
##Creating multipple users## | |
- hosts: all | |
become: yes | |
gather_facts: no | |
vars_prompt: | |
- name: pass | |
prompt: "Please enter the password" | |
tasks: | |
- name: Creating users |
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
--- | |
#Creating memory alarm and make sure CLoudwatch role is assigned to the ec2 instances | |
- hosts: all #must have valid ips,ssh-keys and user-name. | |
become: yes | |
gather_facts: yes | |
tasks: | |
- name: Installing the required packages for Ubuntu Dist | |
apt: | |
name: "{{ item }}" | |
update_cache: yes |
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: local | |
connection: local | |
vars_files: | |
- /home/ansible/awscreds_ec2.yml #contain varible info as mentioned in comments | |
tasks: | |
- name: Get Instance ID | |
ec2_instance_facts: | |
aws_access_key: "{{ aws_id }}" | |
aws_secret_key: "{{ aws_key }}" |
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
--- | |
#Creating an AMI based on time but need to schedule this job on Ansible-Tower based on intervals | |
- hosts: local | |
connection: local | |
gather_facts: no | |
vars: | |
aws_region: ap-south-1 | |
tasks: | |
- name: Getting the facts of the system | |
setup: filter=ansible_date_time |
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
#Audit Logs | |
apt-get install auditd audispd-plugins -y | |
systemctl enable auditd | |
#Ensure audit logs are not automatically deleted | |
echo ""max_log_file_action = keep_logs"" >> /etc/audit/auditd.conf | |
#Ensure events that modify date and time information are collected | |
echo ""-a always,exit -F arch=b64 -S adjtimex -S settimeofday -k time-change"" >> /etc/audit/audit.rules |
NewerOlder