-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Labels
ansibleIssues relating to Mitogen for AnsibleIssues relating to Mitogen for AnsiblebugCode feature that hinders desired execution outcomeCode feature that hinders desired execution outcomeuser-reported
Description
This might sound strange, and may even be an unexpected behavior of Ansible to begin with.
I have a vars plugin which sets some environment variables in-process. When I use the stock linear strategy, these vars are visible for plays running on localhost. When I use Mitogen, the vars are not visible.
Reproducing
# vars_plugins/test.py
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible.plugins.vars import BaseVarsPlugin
import os
class VarsModule(BaseVarsPlugin):
def __init__(self, *args):
super(VarsModule, self).__init__(*args)
os.environ['FOO'] = 'bar'
def get_vars(self, loader, path, entities, cache=True):
super(VarsModule, self).get_vars(loader, path, entities)
return {}---
# playbook.yml
- hosts: localhost
strategy: linear
connection: local
tasks:
- shell: "env | grep FOO"
- hosts: localhost
connection: local
tasks:
- shell: "env | grep FOO"I fully admit this is abuse of a vars plugin, but I use it to set context-specific AWS_* variables, so that the correct AWS account is chosen based on some runtime logic.
Look forward to any feedback on this scenario! Is this sane? Fixable in Mitogen or antithetical to Mitogen's design? Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ansibleIssues relating to Mitogen for AnsibleIssues relating to Mitogen for AnsiblebugCode feature that hinders desired execution outcomeCode feature that hinders desired execution outcomeuser-reported