Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
865b1a5e
Commit
865b1a5e
authored
Mar 24, 2016
by
Max Rothman
Committed by
Kevin Falcone
Mar 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OPS-1383: Add role for turning on enhanced networking
parent
72422bb7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
0 deletions
+68
-0
playbooks/roles/enhanced_networking/defaults/main.yml
+3
-0
playbooks/roles/enhanced_networking/tasks/main.yml
+65
-0
No files found.
playbooks/roles/enhanced_networking/defaults/main.yml
0 → 100644
View file @
865b1a5e
profile
:
edx
compatible_instance_types
:
[
'
c3'
,
'
c4'
,
'
d2'
,
'
i2'
,
'
m4'
,
'
r3'
]
\ No newline at end of file
playbooks/roles/enhanced_networking/tasks/main.yml
0 → 100644
View file @
865b1a5e
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role enhanced_networking
#
# Overview:
#
# This role ensures that enhanced networking
# (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html)
# is turned on on the AWS EC2 instances to which it it is applied.
#
# Note that turning on enhanced networking requires this role restart the instances
# where it turns it on. Instances where enhanced networking is already on or where
# enhanced networking is not supported for their instance type will NOT be restarted.
#
# Uses local actions so multiple actions can be done in parallel.
#
-
name
:
Get ec2 facts
ec2_facts
:
-
name
:
Test for enhanced networking
local_action
:
module
:
shell aws --profile {{ profile }} ec2 describe-instance-attribute --instance-id {{ ansible_ec2_instance_id }} --attribute sriovNetSupport
changed_when
:
False
become
:
False
register
:
enhanced_networking_raw
-
set_fact
:
supports_enhanced_networking
:
"
{{
(ansible_ec2_instance_type[:2]
|
lower)
in
compatible_instance_types
}}"
enhanced_networking_already_on
:
"
{{
(enhanced_networking_raw.stdout
|
from_json).SriovNetSupport.Value
|
default(None)
==
'simple'
}}"
-
name
:
Shut down instances
local_action
:
module
:
ec2
instance_ids
:
"
{{
ansible_ec2_instance_id
}}"
state
:
stopped
region
:
"
{{
ansible_ec2_placement_region
}}"
profile
:
"
{{
profile
}}"
wait
:
yes
become
:
False
when
:
supports_enhanced_networking and not enhanced_networking_already_on
-
name
:
Set enhanced networking instance attribute
local_action
:
module
:
shell aws --profile {{ profile }} ec2 modify-instance-attribute --instance-id {{ ansible_ec2_instance_id }} --sriov-net-support simple
when
:
supports_enhanced_networking and not enhanced_networking_already_on
-
name
:
Start instances
local_action
:
module
:
ec2
ansible_ec2_instance_ids
:
"
{{
ansible_ec2_instance_id
}}"
state
:
running
region
:
"
{{
ansible_ec2_placement_region
}}"
profile
:
"
{{
profile
}}"
wait
:
yes
become
:
False
when
:
supports_enhanced_networking and not enhanced_networking_already_on
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment