Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Roles
cloud
Commits
6a80b013
Commit
6a80b013
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Allow the definition of the IP when creating a new host
parent
a79b2f60
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tasks/ec2/inithost.yml
+17
-13
17 additions, 13 deletions
tasks/ec2/inithost.yml
tasks/ec2/inithostip.yml
+16
-0
16 additions, 0 deletions
tasks/ec2/inithostip.yml
with
33 additions
and
13 deletions
tasks/ec2/inithost.yml
+
17
−
13
View file @
6a80b013
...
...
@@ -26,18 +26,22 @@
state
:
running
wait
:
yes
-
name
:
"
Add
new
instance(s)
to
the
inventory"
add_host
:
hostname="{{ host }}"
static_ipv4="{{ item.public_ip }}"
groups="{{ initgroups }}"
with_items
:
'
{{
ec2.instances
}}'
-
block
:
-
name
:
"
Associate
an
elastic
IP
with
the
new
instance"
ec2_eip
:
device_id
:
"
{{
item
}}"
public_ip
:
'
{{
inithostip
}}'
region
:
"
{{
ec2_region
}}"
state
:
present
with_items
:
'
{{
ec2.instance_ids
}}'
-
include
:
inithostip.yml hostip='{{ inithostip }}'
when
:
inithostip is defined
-
name
:
"
Waiting
for
SSH
service
becoming
available"
wait_for
:
host="{{ item.public_ip }}"
port=22
delay=10
timeout=120
state=present
-
include
:
inithostip.yml hostip='{{ ec2instance.public_ip }}'
with_items
:
'
{{
ec2.instances
}}'
loop_control
:
loop_var
:
ec2instance
when
:
inithostip is not defined
This diff is collapsed.
Click to expand it.
tasks/ec2/inithostip.yml
0 → 100644
+
16
−
0
View file @
6a80b013
---
# file: ec2/inithostip.yml
-
name
:
"
Add
new
instance(s)
to
the
inventory"
add_host
:
hostname="{{ host }}"
static_ipv4="{{ hostip }}"
groups="{{ initgroups }}"
-
name
:
"
Waiting
for
SSH
service
becoming
available"
wait_for
:
host="{{ hostip }}"
port=22
delay=10
timeout=120
state=present
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment