-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 16942ac
Showing
9 changed files
with
358 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "ibm_bmx_api_key" { | ||
type = "string" | ||
default = "c1298add565a924d97294b814f8441753db30dd860e43c293134cc71b36d1b90" | ||
} | ||
|
||
variable "ibm_sl_username" { | ||
type = "string" | ||
default = "IBM1557043" | ||
} | ||
|
||
variable "ibm_sl_api_key" { | ||
type = "string" | ||
default = "c1298add565a924d97294b814f8441753db30dd860e43c293134cc71b36d1b90" | ||
} | ||
|
||
variable "vm_count" { | ||
type = "string" | ||
default = "1" | ||
} | ||
|
||
variable "lg_ips_us" { | ||
type = "string" | ||
default = "8.8.8.8" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export GOROOT=/usr/lib/go-1.9 | ||
export PATH=$PATH:$GOROOT/bin |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Configure the IBM Cloud Provider | ||
provider "ibm" { | ||
bluemix_api_key = "${var.ibm_bmx_api_key}" | ||
softlayer_username = "${var.ibm_sl_username}" | ||
softlayer_api_key = "${var.ibm_sl_api_key}" | ||
} | ||
|
||
# Create an SSH key. You can find the SSH key surfaces in the SoftLayer console under Devices > Manage > SSH Keys | ||
|
||
data "ibm_compute_ssh_key" "key_1" { | ||
label = "y19m05" | ||
} | ||
|
||
data "ibm_dns_domain" "domain_vm" { | ||
name = "inppyyoo.net" | ||
} | ||
|
||
# Create a virtual server with the SSH key | ||
resource "ibm_compute_vm_instance" "vm_iccs" { | ||
hostname = "ping01" | ||
domain = "${data.ibm_dns_domain.domain_vm.name}" | ||
ssh_key_ids = ["${data.ibm_compute_ssh_key.key_1.id}"] | ||
os_reference_code = "UBUNTU_16_64" | ||
transient = "true" | ||
hourly_billing = true | ||
local_disk = false | ||
flavor_key_name = "B1_1X2X25" | ||
datacenter = "seo01" | ||
network_speed = 100 | ||
tags = [ | ||
"ping-test" | ||
] | ||
wait_time_minutes = 15 | ||
count = "1" | ||
|
||
connection { | ||
user = "root" | ||
type = "ssh" | ||
private_key = "${file("~/.ssh/id_rsa")}" | ||
timeout = "3m" | ||
} | ||
|
||
provisioner "remote-exec" { | ||
inline = [ | ||
"hostname", | ||
"lsb_release -a" | ||
] | ||
} | ||
|
||
provisioner "remote-exec" { | ||
inline = [ | ||
"sudo apt-get update" | ||
] | ||
} | ||
|
||
provisioner "remote-exec" { | ||
inline = [ | ||
"sudo apt-get install -y python" | ||
] | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = <<EOF | ||
echo "[demo]" > inventory | ||
echo "${ibm_compute_vm_instance.vm_iccs.ipv4_address} ansible_ssh_user=root ansible_ssh_private_key_file=~/.ssh/id_rsa" >> inventory | ||
EOF | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = <<EOF | ||
ANSIBLE_HOST_KEY_CHECKING=False \ | ||
ansible-playbook -i inventory playbook.yaml | ||
EOF | ||
} | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[demo] | ||
169.56.94.67 ansible_ssh_user=root ansible_ssh_private_key_file=~/.ssh/id_rsa |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
169.56.94.68 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
- hosts: all | ||
|
||
user: root | ||
|
||
tasks: | ||
|
||
- name: Install s3fs | ||
apt: name= {{item}} state=present update_cache=yes | ||
with_items: | ||
- apt-transport-https | ||
- curl | ||
- software-properties-common | ||
- python | ||
- python3-pip | ||
- unzip | ||
- s3fs | ||
- awscli | ||
|
||
- name: update | ||
shell: sudo apt-get update -y | ||
|
||
|
||
|
||
- name: packages | ||
shell: sudo apt-get -y install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config | ||
|
||
- name: Clone a repository | ||
git: | ||
repo: 'https://github.com/s3fs-fuse/s3fs-fuse.git' | ||
version: master | ||
dest: /root/a | ||
accept_hostkey: yes | ||
|
||
- name: Install s3fs details - autogen | ||
shell: cd /root/a && sh /root/a/autogen.sh | ||
|
||
- name: Install s3fs details - configure | ||
shell: /root/a/configure | ||
|
||
- name: Install s3fs details - make | ||
shell: cd /root/ %% make | ||
|
||
- name: Install s3fs details - make install | ||
shell: cd /root/ && sudo make install | ||
|
||
- name: make /mnt/s3 forlder | ||
file: | ||
path: /mnt/s3 | ||
state: directory | ||
|
||
- name: Credential into file | ||
shell: echo 52c829f8b84a4eb4b8591ace181945da:67f3001ee1653507ff1ab28453891a324077b7130a8d8171 > ${HOME}/.passwd-s3fs | ||
|
||
- name: "chmod 600 to ${HOME}/.passwd-s3fs" | ||
shell: chmod 600 ${HOME}/.passwd-s3fs | ||
|
||
- name: Credential into file | ||
shell: s3fs iphong /mnt/s3 -o url=http{s}://s3.seo01.cloud-object-storage.appdomain.cloud -o passwd_file=${HOME}/.passwd-s3fs | ||
|
||
- name: server list download | ||
shell: wget https://raw.githubusercontent.com/Kylekr/lg-sample/master/1.txt | ||
|
||
- name: mtr script download | ||
shell: wget https://raw.githubusercontent.com/Kylekr/lg-sample/master/sample.sh | ||
|
||
- name: execute mtr script | ||
shell: sh sample.sh | ||
|
||
|
||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
# Program name: sample.sh | ||
date | ||
cat /root/1.txt | while read output | ||
do | ||
mtr -r -c 10 "$output" --csv > /mnt/s3/result.csv | ||
done |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"version": 3, | ||
"terraform_version": "0.11.11", | ||
"serial": 72, | ||
"lineage": "ff629c9f-3006-e6a4-b900-c95e77260437", | ||
"modules": [ | ||
{ | ||
"path": [ | ||
"root" | ||
], | ||
"outputs": {}, | ||
"resources": { | ||
"data.ibm_compute_ssh_key.key_1": { | ||
"type": "ibm_compute_ssh_key", | ||
"depends_on": [], | ||
"primary": { | ||
"id": "1432849", | ||
"attributes": { | ||
"fingerprint": "49:73:76:5d:83:a4:dc:9c:57:c4:f7:5b:17:af:b6:a9", | ||
"id": "1432849", | ||
"label": "y19m05", | ||
"most_recent": "false", | ||
"notes": "", | ||
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDawgux7227+hFO/j8I81J3QfUQI2qKCVSrvQ+z2Z2rouyAwUILknR0GNCxOg9nePSheBhlywkOJwVYHBvxFHoLDNcYJQONqYEevi/Pcoin52wmamGwLwozGpmA1O7yXRJPOovCiGHTuHNr7hKvlkOJLwIoGX9YdxirAdlpvIJ479u8hJtNebAehsRjqxrgpeGQFbksx7hLytY0GUORplR7V3RKT9VHJxeiJLypcOMqVKrOuqhxITJ/SQ9SaijnDscZRMVu5kJJzaT5mzw080imw8sGrDj1C9Sh7zV9c9Fedtc5RJEZSXu8ZRElQkZ1XDpZeviHTwlBaFSJm6A7MysEE4M7PNGAjjPUswo85mMWenI751k+1N6t+wqh6kCxkqbBLrRTjfpDLfUOYLPDrS3NwgsTuk3Ry0dVIGO2lgyfsfMjFAGZpMpMpO0lB8TVjtdzDKjbgkucP2LESfUyYiGaafCKxYzTeJQwTqEy2JnKfqKYpD2oSBlokxMVOlMT2Y7hOwdgdPovimbusJ9FABCRuAlVExRk4mzVDJAZZk5UNyYGITwS4ZO7nOOwrZ9uTBQquGWuc6V9LSROSSVAFK4pUM0ySIG31Tkvjd98hOCy9lWhLFetnxKkMvKb3DP9EuSDNLUk89oshyvSZB0hTq/iWIbouJnq37D0TIqAc4GV3w== [email protected]" | ||
}, | ||
"meta": {}, | ||
"tainted": false | ||
}, | ||
"deposed": [], | ||
"provider": "provider.ibm" | ||
}, | ||
"data.ibm_dns_domain.domain_vm": { | ||
"type": "ibm_dns_domain", | ||
"depends_on": [], | ||
"primary": { | ||
"id": "2607589", | ||
"attributes": { | ||
"id": "2607589", | ||
"name": "inppyyoo.net" | ||
}, | ||
"meta": {}, | ||
"tainted": false | ||
}, | ||
"deposed": [], | ||
"provider": "provider.ibm" | ||
}, | ||
"ibm_compute_vm_instance.vm_iccs": { | ||
"type": "ibm_compute_vm_instance", | ||
"depends_on": [ | ||
"data.ibm_compute_ssh_key.key_1", | ||
"data.ibm_dns_domain.domain_vm" | ||
], | ||
"primary": { | ||
"id": "", | ||
"attributes": {}, | ||
"meta": {}, | ||
"tainted": false | ||
}, | ||
"deposed": [], | ||
"provider": "provider.ibm" | ||
} | ||
}, | ||
"depends_on": [] | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
{ | ||
"version": 3, | ||
"terraform_version": "0.11.11", | ||
"serial": 72, | ||
"lineage": "ff629c9f-3006-e6a4-b900-c95e77260437", | ||
"modules": [ | ||
{ | ||
"path": [ | ||
"root" | ||
], | ||
"outputs": {}, | ||
"resources": { | ||
"data.ibm_compute_ssh_key.key_1": { | ||
"type": "ibm_compute_ssh_key", | ||
"depends_on": [], | ||
"primary": { | ||
"id": "1432849", | ||
"attributes": { | ||
"fingerprint": "49:73:76:5d:83:a4:dc:9c:57:c4:f7:5b:17:af:b6:a9", | ||
"id": "1432849", | ||
"label": "y19m05", | ||
"most_recent": "false", | ||
"notes": "", | ||
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDawgux7227+hFO/j8I81J3QfUQI2qKCVSrvQ+z2Z2rouyAwUILknR0GNCxOg9nePSheBhlywkOJwVYHBvxFHoLDNcYJQONqYEevi/Pcoin52wmamGwLwozGpmA1O7yXRJPOovCiGHTuHNr7hKvlkOJLwIoGX9YdxirAdlpvIJ479u8hJtNebAehsRjqxrgpeGQFbksx7hLytY0GUORplR7V3RKT9VHJxeiJLypcOMqVKrOuqhxITJ/SQ9SaijnDscZRMVu5kJJzaT5mzw080imw8sGrDj1C9Sh7zV9c9Fedtc5RJEZSXu8ZRElQkZ1XDpZeviHTwlBaFSJm6A7MysEE4M7PNGAjjPUswo85mMWenI751k+1N6t+wqh6kCxkqbBLrRTjfpDLfUOYLPDrS3NwgsTuk3Ry0dVIGO2lgyfsfMjFAGZpMpMpO0lB8TVjtdzDKjbgkucP2LESfUyYiGaafCKxYzTeJQwTqEy2JnKfqKYpD2oSBlokxMVOlMT2Y7hOwdgdPovimbusJ9FABCRuAlVExRk4mzVDJAZZk5UNyYGITwS4ZO7nOOwrZ9uTBQquGWuc6V9LSROSSVAFK4pUM0ySIG31Tkvjd98hOCy9lWhLFetnxKkMvKb3DP9EuSDNLUk89oshyvSZB0hTq/iWIbouJnq37D0TIqAc4GV3w== [email protected]" | ||
}, | ||
"meta": {}, | ||
"tainted": false | ||
}, | ||
"deposed": [], | ||
"provider": "provider.ibm" | ||
}, | ||
"data.ibm_dns_domain.domain_vm": { | ||
"type": "ibm_dns_domain", | ||
"depends_on": [], | ||
"primary": { | ||
"id": "2607589", | ||
"attributes": { | ||
"id": "2607589", | ||
"name": "inppyyoo.net" | ||
}, | ||
"meta": {}, | ||
"tainted": false | ||
}, | ||
"deposed": [], | ||
"provider": "provider.ibm" | ||
}, | ||
"ibm_compute_vm_instance.vm_iccs": { | ||
"type": "ibm_compute_vm_instance", | ||
"depends_on": [ | ||
"data.ibm_compute_ssh_key.key_1", | ||
"data.ibm_dns_domain.domain_vm" | ||
], | ||
"primary": { | ||
"id": "80986231", | ||
"attributes": { | ||
"block_storage_ids.#": "0", | ||
"cores": "1", | ||
"datacenter": "seo01", | ||
"dedicated_acct_host_only": "false", | ||
"disks.#": "0", | ||
"domain": "inppyyoo.net", | ||
"file_storage_ids.#": "0", | ||
"flavor_key_name": "B1_1X2X25", | ||
"hostname": "ping01", | ||
"hourly_billing": "true", | ||
"id": "80986231", | ||
"ip_address_id": "106705053", | ||
"ip_address_id_private": "106705305", | ||
"ipv4_address": "169.56.94.67", | ||
"ipv4_address_private": "10.178.24.69", | ||
"ipv6_enabled": "false", | ||
"ipv6_static_enabled": "false", | ||
"local_disk": "false", | ||
"memory": "2048", | ||
"network_speed": "100", | ||
"notes": "", | ||
"os_reference_code": "UBUNTU_16_64", | ||
"private_interface_id": "48873579", | ||
"private_network_only": "false", | ||
"private_security_group_ids.#": "0", | ||
"private_subnet": "10.178.24.64/26", | ||
"private_subnet_id": "1285279", | ||
"private_vlan_id": "2241471", | ||
"public_bandwidth_unlimited": "false", | ||
"public_interface_id": "48873581", | ||
"public_security_group_ids.#": "0", | ||
"public_subnet": "169.56.94.64/28", | ||
"public_subnet_id": "1478959", | ||
"public_vlan_id": "2241469", | ||
"secondary_ip_addresses.#": "0", | ||
"ssh_key_ids.#": "1", | ||
"ssh_key_ids.1432849": "1432849", | ||
"tags.#": "1", | ||
"tags.3608948244": "ping-test", | ||
"transient": "true", | ||
"wait_time_minutes": "15" | ||
}, | ||
"meta": {}, | ||
"tainted": true | ||
}, | ||
"deposed": [], | ||
"provider": "provider.ibm" | ||
} | ||
}, | ||
"depends_on": [] | ||
} | ||
] | ||
} |