Skip to content

Commit

Permalink
update ansible python for user if not there (#155)
Browse files Browse the repository at this point in the history
* update ansible python for user if not there

* bump version
  • Loading branch information
EarthmanT authored Dec 12, 2022
1 parent ac93738 commit 310e5fa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,5 @@
3.0.1: RD-5970 ansible plugin role installation
3.0.2: CYBL-1898 fix update venv workflow propositional argument and fix mis-match between plugin files.
3.1.0: RD-5392 Kerberos Support
3.1.1: Add missing configure task
3.1.1: Add missing configure task
3.1.2: Ignore system default for ansible because Cloudify requires python 3.
20 changes: 20 additions & 0 deletions cloudify_ansible/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def run(playbook_args, ansible_env_vars, _ctx, **kwargs):
_instance.runtime_properties[constants.WORKSPACE],
'ansible.cfg')
}

os.environ['CTX_NODE_INSTANCE_ID'] = _instance.id
if 'KRB5_CONFIG' in _instance.runtime_properties:
os.environ['KRB5_CONFIG'] = _instance.runtime_properties['KRB5_CONFIG']
Expand All @@ -132,6 +133,16 @@ def run(playbook_args, ansible_env_vars, _ctx, **kwargs):
}
)

playbook_env = _instance.runtime_properties.get('playbook_env')
if playbook_env and 'ANSIBLE_PYTHON_INTERPRETER' not in \
playbook_args['environment_variables']:
playbook_args['environment_variables'].update(
{
'ANSIBLE_PYTHON_INTERPRETER': os.path.join(
playbook_env, 'bin/python')
}
)

secure_log_playbook_args(_ctx, playbook_args)
playbook = AnsiblePlaybookFromFile(**playbook_args)
# check if ansible_playbook_executable_path was provided
Expand Down Expand Up @@ -277,6 +288,15 @@ def store_facts(playbook_args, ansible_env_vars, _ctx, **kwargs):
'CTX_NODE_INSTANCE_ID': _instance.id,
}
os.environ['CTX_NODE_INSTANCE_ID'] = _instance.id
playbook_env = _instance.runtime_properties.get('playbook_env')
if playbook_env and 'ANSIBLE_PYTHON_INTERPRETER' not in \
playbook_args['environment_variables']:
playbook_args['environment_variables'].update(
{
'ANSIBLE_PYTHON_INTERPRETER': os.path.join(
playbook_env, 'bin/python')
}
)
_store_facts(
playbook,
ansible_env_vars,
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins:
ansible:
executor: central_deployment_agent
package_name: cloudify-ansible-plugin
package_version: '3.1.1'
package_version: '3.1.2'

dsl_definitions:

Expand Down
2 changes: 1 addition & 1 deletion plugin_1_4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins:
ansible:
executor: central_deployment_agent
package_name: cloudify-ansible-plugin
package_version: '3.1.1'
package_version: '3.1.2'

dsl_definitions:

Expand Down
2 changes: 1 addition & 1 deletion v2_plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins:
ansible:
executor: central_deployment_agent
package_name: cloudify-ansible-plugin
package_version: '3.1.1'
package_version: '3.1.2'

dsl_definitions:

Expand Down

0 comments on commit 310e5fa

Please sign in to comment.