-
Notifications
You must be signed in to change notification settings - Fork 27
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
Showing
20 changed files
with
940 additions
and
11 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
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
-----BEGIN PGP SIGNATURE----- | ||
|
||
iQGzBAABCAAdFiEE/bJvyFHKKJdaZDOLTiIiIXrUDNEFAmVOO3wACgkQTiIiIXrU | ||
DNFmoAwAsb07t94Myf7VQUusaHl4zIrpghkuW47NqAvY2PyWpelsqHEJMmIc4hmT | ||
XUlMedLTLXb8IESGDpbt29se2rSOv5lTLoos9x7TQmdPHOypHASgr8NBamha30hN | ||
taWbj6CTTBGeWA7ELwzzuj6i5UrcMS89+zvkaA8+aZmqHjZFyF0s4caioq9PW4L2 | ||
MhGxD7AiHq5ep1JvVNXEdHxr+PiYPIWzn+QrZYZV1tssyMYF2x6C6UlWjX7n9dsU | ||
quwiiPrfur39xeYnZHWU+Ibc6lmtkBaLBUbZsfBElcizGu30MkKTUwjhLw8qdddy | ||
kCA1+UOnhVrmZtAw0xAaZ80648mRbqPUyA+yqtuyA4PtY62cmw66Vjs+Ztze8fUu | ||
GxOybkYo5LTic43nw5ysmoLicb30MU8sFjDgTlE8VVPMeWDF0NIlhF1F0t3x62ya | ||
r/1egVfrAAjnDUlgfG19mErRE6/uXvTeXbzjqirwCLylVbDMZ8xCe3DN1CxFCZIE | ||
2kvsYJN3 | ||
=JXrW | ||
iQGzBAABCAAdFiEE/bJvyFHKKJdaZDOLTiIiIXrUDNEFAmVOUp0ACgkQTiIiIXrU | ||
DNHqIwv+K7rY/7Kmz5Lzpn6nYZvFksE6/ozrTjdi6k6peuXux4Rl7lDomm7oyuZQ | ||
QawrCE+qkRKVqHvgncHGI/iYJVZYpbgEd73yWqWRA8l+TkWS39LenHrxHXgBQ1n0 | ||
9a19Hy8+OUDNXAhbfOizNo/MV6XXeT4xF7vCJZqur6TPjIOBKDuHajoQrfsje1jD | ||
2mMCT92RREybf4S9r9W7BU9v961mAkzfq9Z14BrxD+kgh4/M2pyXmmJ7oeBAJgt/ | ||
HDDda++yR6maBE685Lw40Q8zkPDnOveqUpFNyip1XpOgpsTyJqsLRBqB3PQ5ED+W | ||
DT8Cy9e67S1VH0uTFIe7uT7xDVxbuRgFez9WVdGqTMTV2Ndn6pQc8Veeqe6y1OVc | ||
8JVoDf6LIgqL+b+SkGAadXv2Ywt0A7Y8DDl2dJIED9C67mfF8serEDsBi/KhlW1H | ||
Jmk/Yd/SyzvWCh1r/MGozpPhkewcKVHae5b8YpGliOcOW3hIQsgOCIyyogrzTTFr | ||
pG2CzVxC | ||
=Z/Kx | ||
-----END PGP SIGNATURE----- |
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,15 @@ | ||
--- | ||
- name: Create AWS Detailed Report | ||
hosts: localhost | ||
tasks: | ||
|
||
- name: Gather AWS Detailed info | ||
ansible.builtin.include_role: | ||
name: aws_retrieve_info | ||
|
||
- name: Build the report | ||
ansible.builtin.include_role: | ||
name: build_report_aws | ||
apply: | ||
delegate_to: report.shadowman.dev | ||
run_once: true |
Empty file.
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,21 @@ | ||
--- | ||
- name: Loop over all ec2 regions | ||
ansible.builtin.include_tasks: | ||
file: retrieve_info.yml | ||
loop: "{{ ec2_regions }}" | ||
|
||
- name: Grab boto version | ||
ansible.builtin.pip: | ||
name: boto3 | ||
register: register_boto3_version | ||
check_mode: true | ||
|
||
- name: Grab information about AWS user | ||
amazon.aws.aws_caller_info: | ||
register: whoami | ||
|
||
- name: Save username of AWS user and boto3 version | ||
ansible.builtin.set_fact: | ||
aws_user: '{{ whoami.arn.split("/")[-1] }}' | ||
boto3_version: >- | ||
{{ lookup('pipe', ansible_playbook_python ~ ' -c "import boto3; print(boto3.__version__)"') | default('unknown') }} |
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,30 @@ | ||
--- | ||
- name: Retrieve vpc information for {{ item }} | ||
amazon.aws.ec2_vpc_net_info: | ||
region: "{{ item }}" | ||
register: vpc_info | ||
delegate_to: localhost | ||
|
||
- name: Retrieve info for ec2 instances | ||
amazon.aws.ec2_instance_info: | ||
region: "{{ item }}" | ||
register: ec2_instance_info | ||
delegate_to: localhost | ||
|
||
- name: Retrieve information about Internet Gateways IGWs | ||
amazon.aws.ec2_vpc_igw_info: | ||
region: "{{ item }}" | ||
register: igw_info | ||
delegate_to: localhost | ||
|
||
# Dashes are not allowed as Ansible var names so we use underscores _ | ||
- name: Set facts all info for {{ item }} | ||
ansible.builtin.set_fact: | ||
'{{ item|replace("-", "_") }}': | ||
vpc_info: '{{ vpc_info }}' | ||
ec2_instance_info: '{{ ec2_instance_info }}' | ||
igw_info: '{{ igw_info }}' | ||
|
||
- name: Set facts all info for {{ item }} | ||
Check failure on line 28 in roles/aws_retrieve_info/tasks/retrieve_info.yml GitHub Actions / buildjinja[spacing]
|
||
ansible.builtin.set_fact: | ||
all_ec2_regions: "{{ all_ec2_regions | default ([]) + [{ item | replace('-','_'): hostvars[inventory_hostname][item | replace('-','_')]}] }}" |
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,57 @@ | ||
build_report_azure | ||
======== | ||
|
||
Installs Apache and creates a report based on facts from Azure. | ||
|
||
Requirements | ||
------------ | ||
|
||
Must deploy to Apache server | ||
|
||
Role Variables / Configuration | ||
-------------- | ||
|
||
N/A | ||
|
||
Dependencies | ||
------------ | ||
|
||
N/A | ||
|
||
Example Playbook | ||
---------------- | ||
|
||
The role can be used to create an html report on Azure statistics onto an apache server. | ||
|
||
|
||
``` | ||
--- | ||
- name: Create Cloud Report | ||
hosts: localhost | ||
tasks: | ||
- name: Get list of all regions | ||
azure.azcollection.azure_rm_resource_info: | ||
url: "/locations" | ||
api_version: "2020-01-01" | ||
register: all_regions | ||
- name: Get all networks | ||
azure.azcollection.azure_rm_virtualnetwork_info: | ||
register: azure_networks | ||
- name: Get all vms | ||
azure.azcollection.azure_rm_virtualmachine_info: | ||
register: azure_vms | ||
- name: Get facts for network interfaces | ||
azure.azcollection.azure_rm_networkinterface_info: | ||
register: network_interfaces | ||
- name: Build the report | ||
ansible.builtin.include_role: | ||
name: shadowman.reports.build_report_azure | ||
apply: | ||
delegate_to: report.shadowman.dev | ||
run_once: true | ||
``` |
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 @@ | ||
--- | ||
usesingletemplate: false |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.