-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from rundeck-plugins/issue_rpl-36_child-groups
RPL-36: Fix - Ansible process sub children
- Loading branch information
Showing
7 changed files
with
245 additions
and
32 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
functional-test/src/test/groovy/functional/ChildGroupsSpec.groovy
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,45 @@ | ||
package functional | ||
|
||
import functional.base.BaseTestConfiguration | ||
import org.testcontainers.spock.Testcontainers | ||
|
||
@Testcontainers | ||
class ChildGroupsSpec extends BaseTestConfiguration { | ||
|
||
static String NODENAME = 'nodename' | ||
static String HOSTNAME = 'hostname' | ||
static String TAGS = 'tags' | ||
static String PROJ_NAME = 'ansible-child-groups' | ||
static String NODE_1 = 'one.example.com' | ||
static String TAGS_1 = 'dbservers, east, prod' | ||
static String NODE_2 = 'three.example.com' | ||
static String TAGS_2 = 'dbservers, test, west' | ||
static String NODE_3 = 'mail.example.com' | ||
static String TAGS_3 = 'ungrouped' | ||
|
||
def setupSpec() { | ||
startCompose() | ||
configureRundeck(PROJ_NAME, NODE_1) | ||
} | ||
|
||
void "child groups"() { | ||
when: | ||
def result = client.apiCall {api-> api.listNodes(PROJ_NAME,'.*')} | ||
|
||
then: | ||
result != null | ||
result.size() == 7 | ||
result.get(NODE_1) != null | ||
result.get(NODE_1).getAttributes().get(NODENAME) == NODE_1 | ||
result.get(NODE_1).getAttributes().get(HOSTNAME) == NODE_1 | ||
result.get(NODE_1).getAttributes().get(TAGS) == TAGS_1 | ||
result.get(NODE_2) != null | ||
result.get(NODE_2).getAttributes().get(NODENAME) == NODE_2 | ||
result.get(NODE_2).getAttributes().get(HOSTNAME) == NODE_2 | ||
result.get(NODE_2).getAttributes().get(TAGS) == TAGS_2 | ||
result.get(NODE_3) != null | ||
result.get(NODE_3).getAttributes().get(NODENAME) == NODE_3 | ||
result.get(NODE_3).getAttributes().get(HOSTNAME) == NODE_3 | ||
result.get(NODE_3).getAttributes().get(TAGS) == TAGS_3 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
functional-test/src/test/resources/docker/ansible-child-groups/ansible.cfg
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 @@ | ||
[defaults] | ||
inventory=/home/rundeck/ansible-child-groups/inventory_child.yaml | ||
interpreter_python=/usr/bin/python3 | ||
|
||
|
||
|
27 changes: 27 additions & 0 deletions
27
functional-test/src/test/resources/docker/ansible-child-groups/inventory_child.yaml
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,27 @@ | ||
ungrouped: | ||
hosts: | ||
mail.example.com: | ||
webservers: | ||
hosts: | ||
foo.example.com: | ||
bar.example.com: | ||
dbservers: | ||
hosts: | ||
one.example.com: | ||
two.example.com: | ||
three.example.com: | ||
east: | ||
hosts: | ||
foo.example.com: | ||
one.example.com: | ||
two.example.com: | ||
west: | ||
hosts: | ||
bar.example.com: | ||
three.example.com: | ||
prod: | ||
children: | ||
east: | ||
test: | ||
children: | ||
west: |
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
8 changes: 8 additions & 0 deletions
8
...es/project-import/ansible-child-groups/rundeck-child-groups/files/acls/node-acl.aclpolicy
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,8 @@ | ||
by: | ||
urn: project:ansible-yaml-parsing | ||
for: | ||
storage: | ||
- match: | ||
path: 'keys/.*' | ||
allow: [read] | ||
description: Allow access to key storage |
31 changes: 31 additions & 0 deletions
31
...ces/project-import/ansible-child-groups/rundeck-child-groups/files/etc/project.properties
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,31 @@ | ||
#edit below | ||
project.disable.executions=false | ||
project.disable.schedule=false | ||
project.execution.history.cleanup.batch=500 | ||
project.execution.history.cleanup.enabled=false | ||
project.execution.history.cleanup.retention.days=60 | ||
project.execution.history.cleanup.retention.minimum=50 | ||
project.execution.history.cleanup.schedule=0 0 0 1/1 * ? * | ||
project.jobs.gui.groupExpandLevel=1 | ||
project.later.executions.disable.value=0 | ||
project.later.executions.disable=false | ||
project.later.executions.enable.value= | ||
project.later.executions.enable=false | ||
project.later.schedule.disable.value= | ||
project.later.schedule.disable=false | ||
project.later.schedule.enable.value= | ||
project.later.schedule.enable=false | ||
project.name=ansible-yaml-parsing | ||
project.nodeCache.enabled=false | ||
project.nodeCache.firstLoadSynch=true | ||
project.output.allowUnsanitized=false | ||
project.retry-counter=3 | ||
project.ssh-authentication=privateKey | ||
resources.source.1.type=local | ||
resources.source.2.config.ansible-config-file-path=/home/rundeck/ansible-child-groups/ansible.cfg | ||
resources.source.2.config.ansible-gather-facts=false | ||
resources.source.2.config.ansible-ignore-errors=true | ||
resources.source.2.config.ansible-inventory=/home/rundeck/ansible-child-groups/inventory_child.yaml | ||
resources.source.2.type=com.batix.rundeck.plugins.AnsibleResourceModelSourceFactory | ||
service.FileCopier.default.provider=sshj-scp | ||
service.NodeExecutor.default.provider=sshj-ssh |
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