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
| #!/bin/bash | |
| # This script is written to make your EC2 Linux machine Router | |
| # With this you can setup your linux machine as gateway. | |
| #################################################################################### | |
| ####### Dont forget to disable source/destination checks on the NAT instance ####### | |
| #################################################################################### | |
| # Deleting all the iptables rules | |
| iptables --flush |
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: all | |
| tasks: | |
| - name: Download MS product repository | |
| get_url: | |
| url: https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb | |
| dest: /tmp/packages-microsoft-prod.deb | |
| - name: Install MS product repository | |
| apt: deb=/tmp/packages-microsoft-prod.deb | |
| become: true |
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
| #Add the Ubuntu 12.04(precise) repositories | |
| cat <<EOF >> /etc/apt/sources.list | |
| deb http://archive.ubuntu.com/ubuntu precise main restricted universe | |
| deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe | |
| deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse | |
| EOF | |
| # Update the repos | |
| apt-get update |
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
| # files/env: | |
| Defaults env_keep += "SSH_AUTH_SOCK" | |
| # tasks/main.yml | |
| - name: ensure sudo keeps SSH_AUTH_SOCK in environment | |
| copy: src=env | |
| dest=/etc/sudoers.d/env | |
| mode=0440 | |
| owner=root | |
| group=root |
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/domain names that are valid for this site; required if DEBUG is False | |
| # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts | |
| ALLOWED_HOSTS = [ | |
| 'yourdomain.tld', | |
| '.compute-1.amazonaws.com', # allows viewing of instances directly | |
| ] | |
| import requests | |
| EC2_PRIVATE_IP = None | |
| try: |
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
| import ansible.utils as utils | |
| # | |
| # Put this file in lookup_plugins/ alongside your playbooks. | |
| # | |
| # Lookup plugins can be called two ways: via with_ as a task loop | |
| # construct, or via lookup('name'). | |
| # | |
| # You can find the code for the basic lookup plugins here: | |
| # v1: https://github.com/ansible/ansible/tree/devel/v1/ansible/runner/lookup_plugins | |
| # v2: https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/lookup |
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
| # best practice: linux | |
| nano ~/.pgpass | |
| *:5432:*:username:password | |
| chmod 0600 ~/.pgpass | |
| # best practice: windows | |
| edit %APPDATA%\postgresql\pgpass.conf | |
| *:5432:*:username:password | |
| # linux |
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
| Vagrant.configure('2') do |config| | |
| ENV['HOST'] ||= '_ sys._' | |
| config.vm.box = 'debian/contrib-buster64' | |
| config.vm.hostname = File.basename(Dir.pwd) + '.test' | |
| config.vm.network 'private_network', type: 'dhcp' | |
| config.trigger.after :reload, :resume, :up do |trig| | |
| trig.info = 'Updating sytstem hosts...' | |
| trig.ruby do |env, vm| |
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
| let’s list block devices attached to our box: | |
| lsblk | |
| # install "cloud-guest-utils" if it is not installed already | |
| apt install cloud-guest-utils | |
| # resize partition | |
| growpart /dev/xvda 1 OR growpart /dev/nvme0n1 1 | |
| # resize filesystem |
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
| #!/usr/bin/env python | |
| ### Import required python libraries | |
| import os | |
| import time | |
| import shutil | |
| from boto.s3.connection import S3Connection | |
| from boto.s3.key import Key |
NewerOlder