google and azure

pull/47/head
jack 8 years ago
parent 97865f40ec
commit 3870956f0a

@ -0,0 +1,99 @@
- name: Configure the server and install required software
hosts: localhost
gather_facts: false
vars:
regions:
"1": "East US"
"2": "West US"
"3": "South Central US"
"4": "North Europe"
"5": "East Asia"
"6": "Japan East"
"7": "West Europe"
"8": "Southeast Asia"
"9": "Japan West"
"10": "North Central US"
"11": "Central US"
"12": "Brazil South"
"13": "East US 2"
"14": "Australia Southeast"
"15": "Australia East"
#vars_prompt:
#- name: "azure_subscription_id"
#prompt: "Enter your subscription ID (https://blogs.msdn.microsoft.com/mschray/2015/05/13/getting-your-azure-guid-subscription-id/):\n"
#private: yes
#- name: "management_cert_path"
#prompt: "Enter the local path to your management cert [ex: ~/.ssh/id_rsa.pub] (https://azure.microsoft.com/en-us/documentation/articles/azure-api-management-certs/):\n"
#private: no
#- name: "ssh_public_key"
#prompt: "Enter the local path to your SSH public key [ex: ~/.ssh/id_rsa.pub] :\n"
#private: no
#- name: "region"
#prompt: >
#What region should the server be located in?
#1. East US
#2. West US
#3. South Central US
#4. North Europe
#5. East Asia
#6. Japan East
#7. West Europe
#8. Southeast Asia
#9. Japan West
#10. North Central US
#11. Central US
#12. Brazil South
#13. East US 2
#14. Australia Southeast
#15. Australia East
#Enter the number of your desired region:
#default: "7"
#private: no
#- name: "azure_server_name"
#prompt: "Name the vpn server:\n"
#default: "algo.local"
#private: no
#- name: "dns_enabled"
#prompt: "Do you want to use a local DNS resolver to block ads while surfing? (Y or N):\n"
#default: "Y"
#private: no
#- name: "auditd_enabled"
#prompt: "Do you want to use auditd ? (Y or N):\n"
#default: "Y"
#private: no
roles:
- azure
- name: Post-provisioning tasks
hosts: vpn-host
gather_facts: false
become: true
vars_files:
- config.cfg
pre_tasks:
- name: Install prerequisites
raw: sudo apt-get update -qq && sudo apt-get install -qq -y python2.7
- name: Configure defaults
raw: sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
roles:
- common
- security
- features
- vpn
- { role: logging, when: auditd_enabled is defined and auditd_enabled == 'Y' }

@ -0,0 +1,99 @@
- name: Configure the server and install required software
hosts: localhost
gather_facts: false
vars:
regions:
"1": "East US"
"2": "West US"
"3": "South Central US"
"4": "North Europe"
"5": "East Asia"
"6": "Japan East"
"7": "West Europe"
"8": "Southeast Asia"
"9": "Japan West"
"10": "North Central US"
"11": "Central US"
"12": "Brazil South"
"13": "East US 2"
"14": "Australia Southeast"
"15": "Australia East"
#vars_prompt:
#- name: "azure_subscription_id"
#prompt: "Enter your subscription ID (https://blogs.msdn.microsoft.com/mschray/2015/05/13/getting-your-azure-guid-subscription-id/):\n"
#private: yes
#- name: "management_cert_path"
#prompt: "Enter the local path to your management cert [ex: ~/.ssh/id_rsa.pub] (https://azure.microsoft.com/en-us/documentation/articles/azure-api-management-certs/):\n"
#private: no
#- name: "ssh_public_key"
#prompt: "Enter the local path to your SSH public key [ex: ~/.ssh/id_rsa.pub] :\n"
#private: no
#- name: "region"
#prompt: >
#What region should the server be located in?
#1. East US
#2. West US
#3. South Central US
#4. North Europe
#5. East Asia
#6. Japan East
#7. West Europe
#8. Southeast Asia
#9. Japan West
#10. North Central US
#11. Central US
#12. Brazil South
#13. East US 2
#14. Australia Southeast
#15. Australia East
#Enter the number of your desired region:
#default: "7"
#private: no
#- name: "azure_server_name"
#prompt: "Name the vpn server:\n"
#default: "algo.local"
#private: no
#- name: "dns_enabled"
#prompt: "Do you want to use a local DNS resolver to block ads while surfing? (Y or N):\n"
#default: "Y"
#private: no
#- name: "auditd_enabled"
#prompt: "Do you want to use auditd ? (Y or N):\n"
#default: "Y"
#private: no
roles:
- google_cloud
- name: Post-provisioning tasks
hosts: vpn-host
gather_facts: false
become: true
vars_files:
- config.cfg
pre_tasks:
- name: Install prerequisites
raw: sudo apt-get update -qq && sudo apt-get install -qq -y python2.7
- name: Configure defaults
raw: sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
roles:
- common
- security
- features
- vpn
- { role: logging, when: auditd_enabled is defined and auditd_enabled == 'Y' }

@ -0,0 +1,45 @@
- local_action:
module: azure
name: my-virtual-machine
role_size: Small
image: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu_DAILY_BUILD-precise-12_04_3-LTS-amd64-server-20131205-en-us-30GB
location: 'East US'
user: ubuntu
ssh_cert_path: "/home/jack/.ssh/upwork.pub"
storage_account: my-storage-account
wait: yes
subscription_id: "02e68d20-1a39-4faa-aa35-6bdd0238b54e"
management_cert_path: "/home/jack/ownCloud/Clouds/azure/manage.cer"
#- name: "Creating a virtual machine..."
#azure:
#subscription_id: "02e68d20-1a39-4faa-aa35-6bdd0238b54e"
#name: "algo-vpn"
#role_size: Small
#image: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-16_04-LTS-amd64-server-20160721-en-us-30GB
#location: "West Europe"
#user: ubuntu
#ssh_cert_path: "/home/jack/.ssh/upwork.pub"
#storage_account: 'algo.vpn'
#management_cert_path: "/home/jack/ownCloud/Clouds/azure/manage.cer"
#wait: yes
#state: present
#register: azure_vm
- debug: msg="{{ azure_vm }}"
#- name: Add the droplet to an inventory group
#add_host:
#name: "{{ do.droplet.ip_address }}"
#groups: vpn-host
#ansible_ssh_user: root
#ansible_python_interpreter: "/usr/bin/python2.7"
#do_access_token: "{{ do_access_token }}"
#do_droplet_id: "{{ do.droplet.id }}"
#dns_enabled: "{{ dns_enabled }}"
#auditd_enabled: " {{ auditd_enabled }}"
#- name: Wait for SSH to become available
#local_action: "wait_for port=22 host={{ do.droplet.ip_address }} timeout=320"

@ -0,0 +1,13 @@
- name: Launch instances
gce:
instance_names: dev
zone: us-central1-b
machine_type: n1-standard-1
image: debian-7-wheezy
service_account_email: e601809@gmail.com
credentials_file: '/home/jack/ownCloud/Clouds/Google/My First Project-72e386228f5e.json'
project_id: algo-833@storied-bearing-140310.iam.gserviceaccount.com
register: google_vm
- debug: msg="{{ google_vm }}"
Loading…
Cancel
Save