Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
commonconnect
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
commonconnect
Commits
90d0f790
Commit
90d0f790
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Read inventory directly
parent
13cd279f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tasks/more.yml
+2
-7
2 additions, 7 deletions
tasks/more.yml
with
2 additions
and
7 deletions
tasks/more.yml
+
2
−
7
View file @
90d0f790
---
# file: roles/commonconnect/tasks/more.yml
-
name
:
"
Read
facts"
shell
:
cat ~/.ansible/hostvars/{{ inventory_name }}
become
:
no
register
:
result_facts
-
set_fact
:
facts="{{ result_facts.stdout | from_json }}"
-
set_fact
:
facts="{{ lookup('file','~/.ansible/hostvars/{{ inventory_name }}') | from_json }}"
-
name
:
"
Add
Hosts
to
Hostfile"
lineinfile
:
...
...
@@ -14,4 +9,4 @@
regexp
:
'
.*
{{
item
}}$'
line
:
'
{{
facts[item].static_ipv4
}}
{{
item
}}'
state
:
'
present'
with_items
:
'
{{
facts
}}'
with_items
:
'
{{
facts
|default([])
}}'
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