mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
move set_artifact module to its own repository
This commit is contained in:
parent
5d4cf9d4fc
commit
ef861e5256
@ -821,11 +821,6 @@ class RunJob(BaseTask):
|
||||
env['ANSIBLE_CACHE_PLUGINS'] = self.get_path_to('..', 'plugins', 'fact_caching')
|
||||
env['ANSIBLE_CACHE_PLUGIN'] = "tower"
|
||||
env['ANSIBLE_CACHE_PLUGIN_CONNECTION'] = "tcp://127.0.0.1:%s" % str(settings.FACT_CACHE_PORT)
|
||||
|
||||
# Set artifact module path
|
||||
# TODO: restrict this to workflow jobs, or JTs expecting artifacts
|
||||
env['ANSIBLE_LIBRARY'] = self.get_path_to('..', 'plugins', 'library')
|
||||
|
||||
return env
|
||||
|
||||
def build_args(self, job, **kwargs):
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from ansible.module_utils.basic import * # noqa
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: set_artifact
|
||||
short_description: Stash some Ansible variables for later
|
||||
description:
|
||||
- Saves a user-specified JSON dictionary of variables from a playbook
|
||||
for later use
|
||||
version_added: "2.2"
|
||||
options:
|
||||
requirements: [ ]
|
||||
author: Alan Rominger
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
# Example fact output:
|
||||
|
||||
# Simple specifying of an artifact dictionary, will be passed on callback
|
||||
- set_artifact:
|
||||
data:
|
||||
one_artifact: "{{ local_var * 2 }}"
|
||||
another_artifact: "{{ some_registered_var.results | map(attribute='ansible_facts.some_fact') | list }}"
|
||||
|
||||
|
||||
# Specifying a local path to save the artifacts to
|
||||
- set_artifact:
|
||||
data:
|
||||
one_artifact: "{{ local_var * 2 }}"
|
||||
another_artifact: "{{ some_registered_var.results | map(attribute='ansible_facts.some_fact') | list }}"
|
||||
dest=/tmp/prefix-{{ inventory_hostname }}
|
||||
|
||||
|
||||
|
||||
host | success >> {
|
||||
"artifact_data": {}
|
||||
}
|
||||
'''
|
||||
|
||||
def main():
|
||||
import json
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
data=dict(
|
||||
type='dict',
|
||||
default={}
|
||||
)
|
||||
)
|
||||
)
|
||||
results = dict(
|
||||
changed=True,
|
||||
artifact_data=json.dumps(module.params.get('data'))
|
||||
)
|
||||
module.exit_json(**results)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
x
Reference in New Issue
Block a user