File: custom_python_modify_environ.py

package info (click to toggle)
python-mitogen 0.3.0~rc1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,240 kB
  • sloc: python: 19,899; sh: 91; perl: 19; ansic: 18; makefile: 13
file content (22 lines) | stat: -rw-r--r-- 495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python
# I am an Ansible new-style Python module. I modify the process environment and
# don't clean up after myself.

from ansible.module_utils.basic import AnsibleModule

import os
import pwd
import socket
import sys


def main():
    module = AnsibleModule(argument_spec={
        'key': {'type': 'str'},
        'val': {'type': 'str'}
    })
    os.environ[module.params['key']] = module.params['val']
    module.exit_json(msg='Muahahaha!')

if __name__ == '__main__':
    main()