-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add role to create GCP instance. Add new line at end of file.
Signed-off-by: Avery Blanchard <[email protected]>
- Loading branch information
Avery Blanchard
committed
Jul 13, 2022
1 parent
20d207d
commit cabaaf4
Showing
15 changed files
with
142 additions
and
13 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
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 @@ | ||
--- | ||
# defaults file for ansible-keylime |
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,6 @@ | ||
--- | ||
# handlers file for ansible-keylime | ||
#- name: restart apache | ||
# command: service https restart | ||
# args: | ||
# warn: no |
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,12 @@ | ||
--- | ||
galaxy_info: | ||
author: Avery Blanchard | ||
description: Keylime GCP | ||
company: Red Hat | ||
min_ansible_version: 2.9 | ||
platforms: | ||
- name: Fedora | ||
versions: | ||
- 35 | ||
galaxy_tags: [] | ||
dependencies: [] |
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,67 @@ | ||
- name: Create disk mapped from Fedora image | ||
google.cloud.gcp_compute_disk: | ||
name: disk-instance | ||
size_gb: 50 | ||
source_image: /projects/fedora-cloud/global/images/fedora-cloud-base-gcp-35-1-2-x86-64 | ||
zone: "{{ zone }}" | ||
project: "{{ gcp_project }}" | ||
auth_kind: "{{ gcp_cred_kind }}" | ||
service_account_file: "{{ gcp_cred_file }}" | ||
scopes: | ||
- https://www.googleapis.com/auth/compute | ||
state: present | ||
register: disk | ||
|
||
- name: Create IPv4 public instance address | ||
google.cloud.gcp_compute_address: | ||
name: address-instance | ||
region: "{{ region }}" | ||
project: "{{ gcp_project }}" | ||
auth_kind: "{{ gcp_cred_kind }}" | ||
service_account_file: "{{ gcp_cred_file }}" | ||
scopes: | ||
- https://www.googleapis.com/auth/compute | ||
state: present | ||
register: address | ||
|
||
- name: Create the Fedora instance | ||
google.cloud.gcp_compute_instance: | ||
name: test | ||
machine_type: e2-medium | ||
disks: | ||
- auto_delete: 'true' | ||
boot: 'true' | ||
source: "{{ disk }}" | ||
shielded_instance_config: | ||
enable_integrity_monitoring: 'no' | ||
enable_secure_boot: 'no' | ||
enable_vtpm: 'yes' | ||
network_interfaces: | ||
- network: null | ||
access_configs: | ||
- name: External NAT | ||
nat_ip: "{{ address }}" | ||
type: ONE_TO_ONE_NAT | ||
zone: "{{ zone }}" | ||
project: "{{ gcp_project }}" | ||
auth_kind: "{{ gcp_cred_kind }}" | ||
service_account_file: "{{ gcp_cred_file }}" | ||
service_accounts: | ||
- email: '[email protected]' | ||
scopes: | ||
- https://www.googleapis.com/auth/devstorage.read_only | ||
- https://www.googleapis.com/auth/logging.write | ||
- https://www.googleapis.com/auth/monitoring.write | ||
- https://www.googleapis.com/auth/service.management.readonly | ||
- https://www.googleapis.com/auth/servicecontrol | ||
- https://www.googleapis.com/auth/trace.append | ||
state: present | ||
|
||
- name: Add new GCP instance to hosts | ||
add_host: | ||
hostname: "{{ address.address }}" | ||
groups: gcp_instance | ||
|
||
- name: Show instance details | ||
debug: | ||
msg: "New GCP instance accessible at {{ address.address }}." |
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 @@ | ||
- include: gcp.yml |
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,4 @@ | ||
--- | ||
# Section for vars | ||
shell_profiles: | ||
- .bash_profile |
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
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 |
---|---|---|
|
@@ -71,5 +71,6 @@ | |
- openssl-devel | ||
- zeromq-devel | ||
- libarchive-devel | ||
- cargo | ||
|
||
state: latest | ||
state: latest |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
shell: "source $HOME/.cargo/env" | ||
args: | ||
chdir: /root/ | ||
changed_when: false | ||
changed_when: false |
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
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,2 +1 @@ | ||
localhost | ||
|