Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
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
OpenEdx
ansible
Commits
4420379f
Commit
4420379f
authored
Sep 23, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing some bugs found during testing in the host module
parent
da0d50c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
CHANGELOG.md
+1
-0
library/system/host
+5
-6
No files found.
CHANGELOG.md
View file @
4420379f
...
@@ -15,6 +15,7 @@ New modules:
...
@@ -15,6 +15,7 @@ New modules:
*
cloud:ec2_eip -- manage AWS elastic IP's
*
cloud:ec2_eip -- manage AWS elastic IP's
*
cloud:rax_clb_nodes -- manage Rackspace cloud load balancers
*
cloud:rax_clb_nodes -- manage Rackspace cloud load balancers
*
system: firewalld -- manage the firewalld configuration
*
system: firewalld -- manage the firewalld configuration
*
system: host -- manage host file entries and aliases
*
system: modprobe -- manage kernel modules on systems that support modprobe/rmmod
*
system: modprobe -- manage kernel modules on systems that support modprobe/rmmod
Misc changes:
Misc changes:
...
...
library/system/host
View file @
4420379f
...
@@ -50,11 +50,10 @@ options:
...
@@ -50,11 +50,10 @@ options:
EXAMPLES
=
'''
EXAMPLES
=
'''
# Example host command from Ansible Playbooks
# Example host command from Ansible Playbooks
- host: ip=127.0.0.1 hostname=localhost aliases=foobar.com,localhost.foobar.com
- host: ip=127.0.0.1 hostname=localhost state=present
- host: ip=127.0.0.1 hostname=localhost state=present
- host: ip=127.0.0.1 hostname=localhost aliases=foobar.com,localhost.foobar.com
- host: ip=192.168.1.1 state=absent
- host: ip=192.168.1.1 state=absent
- host: hostname=localhost state=absent
- host: ip=::1 hostname=localhost6 aliases=ip6-localhost,ip6-loopback
- host: ip=::1 hostname=localhost aliases=ip6-localhost,ip6-loopback
'''
'''
import
os
import
os
...
@@ -126,10 +125,10 @@ class Host(object):
...
@@ -126,10 +125,10 @@ class Host(object):
def
full_entry_exists
(
self
):
def
full_entry_exists
(
self
):
if
self
.
_has_aliases
and
not
self
.
_aliases_matches
:
if
self
.
_has_aliases
and
not
self
.
_aliases_matches
:
return
False
return
False
return
self
.
_ip_matches
and
self
.
hostname_matches
return
self
.
_ip_matches
and
self
.
_
hostname_matches
def
entry_exists
(
self
):
def
entry_exists
(
self
):
return
self
.
_ip_matches
or
self
.
hostname_matches
return
self
.
_ip_matches
or
self
.
_
hostname_matches
def
remove_entry
(
self
):
def
remove_entry
(
self
):
self
.
_hostsfile_lines
.
pop
(
self
.
_found_on_line
)
self
.
_hostsfile_lines
.
pop
(
self
.
_found_on_line
)
...
@@ -165,7 +164,7 @@ def main():
...
@@ -165,7 +164,7 @@ def main():
result
=
{}
result
=
{}
host
=
Host
(
module
)
host
=
Host
(
module
)
result
[
'state'
]
=
host
.
state
result
[
'state'
]
=
host
.
state
result
[
'changed'
]
=
f
alse
result
[
'changed'
]
=
F
alse
err
=
host
.
validate_has_hostname_on_present
()
err
=
host
.
validate_has_hostname_on_present
()
if
err
:
if
err
:
...
...
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