Hello Kai,

Unfortunately, I am still getting the error. The current Playbook:

*- hosts: Windows*
*  gather_facts: false*

*  tasks:*
*    - name: Ensure Service status is running and startup mode set to
Automatic*
*      win_service:*
*        name: MSSQLSERVER*
*        state: started*
*        start_mode: auto*

*    - name: Send Job completion notification to MS Teams*
*      command: '/usr/bin/python
/tmp/ansiblescripts/MSTeamsNotifications.pyc'*

*      delegate_to: localhost*


*Result:*
TASK [Send Job completion notification to MS Teams]
****************************
task path:
/var/lib/awx/projects/_6__innersource_cio_config_mgmt/playbooks/mssql/SQLE_Service_Status.yml:15
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: awx
<localhost> EXEC /bin/sh -c 'echo ~awx && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
/var/lib/awx/.ansible/tmp/ansible-tmp-1544892619.83-135217386386436 `" &&
echo ansible-tmp-1544892619.83-135217386386436="` echo
/var/lib/awx/.ansible/tmp/ansible-tmp-1544892619.83-135217386386436 `" ) &&
sleep 0'
Using module file
/var/lib/awx/venv/custom-venv/lib/python2.7/site-packages/ansible/modules/commands/command.py
<localhost> PUT /var/lib/awx/.ansible/tmp/ansible-local-3LdqDbo/tmpLJ0CAV
TO
/var/lib/awx/.ansible/tmp/ansible-tmp-1544892619.83-135217386386436/AnsiballZ_command.py
<localhost> EXEC /bin/sh -c 'chmod u+x
/var/lib/awx/.ansible/tmp/ansible-tmp-1544892619.83-135217386386436/
/var/lib/awx/.ansible/tmp/ansible-tmp-1544892619.83-135217386386436/AnsiballZ_command.py
&& sleep 0'
<localhost> EXEC /bin/sh -c '/var/lib/awx/venv/custom-venv/bin/python
/var/lib/awx/.ansible/tmp/ansible-tmp-1544892619.83-135217386386436/AnsiballZ_command.py
&& sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r
/var/lib/awx/.ansible/tmp/ansible-tmp-1544892619.83-135217386386436/ >
/dev/null 2>&1 && sleep 0'
fatal: [WinTest4143-> localhost]: FAILED! => {
    "changed": true,
    "cmd": [
        "/usr/bin/python",
        "/tmp/ansiblescripts/MSTeamsNotifications.pyc"
    ],
    "delta": "0:00:00.022198",
    "end": "2018-12-15 16:50:20.371504",
    "invocation": {
        "module_args": {
            "_raw_params": "/usr/bin/python
/tmp/ansiblescripts/MSTeamsNotifications.pyc",
            "_uses_shell": false,
            "argv": null,
            "chdir": null,
            "creates": null,
            "executable": null,
            "removes": null,
            "stdin": null,
            "warn": true
        }
    },
    "msg": "non-zero return code",
    "rc": 2,
    "start": "2018-12-15 16:50:20.349306",
    "stderr": "/usr/bin/python: can't open file
'/tmp/ansiblescripts/MSTeamsNotifications.pyc': [Errno 2] No such file or
directory",
    "stderr_lines": [
        "/usr/bin/python: can't open file
'/tmp/ansiblescripts/MSTeamsNotifications.pyc': [Errno 2] No such file or
directory"
    ],
    "stdout": "",
    "stdout_lines": []
}

*Another thing i noticed is, when i try to sudo to awx user, i get a
expired password error. What is the default password for awx user. I don't
remember setting it up anywhere during installation of Tower.*

*# sudo su - awx*
*sudo: Account or password is expired, reset your password and try again*
*Changing password for root.*
*(current) UNIX password:*

*Thanks and Regards,*
*Ankit*

On Sat, Dec 15, 2018 at 8:46 PM Kai Stian Olstad <
ansible-project+l...@olstad.com> wrote:

> On Saturday, 15 December 2018 15:33:57 CET Ankit Vashistha wrote:
> > I tried the following modified playbook:
> >
> > *- hosts: Windows*
> > *  gather_facts: false*
> > *  tasks:*
> > *    - name: Ensure Service status is running and startup mode set to
> > Automatic*
> > *      win_service:*
> > *        name: MSSQLSERVER*
> > *        state: started*
> > *        start_mode: auto*
> >
> >
> > *    - name: Send Job completion notification to MS Teams*
> > *      script: /tmp/ansible_scripts/MSTeamsNotifications.pyc*
> > *      args:*
> > *        executable: /usr/bin/python*
> > *      delegate_to: 127.0.0.1*
>
> Recommend using localhost and not 127.0.0.1, localhost is special in
> Ansible and does the right ting.
>
> The script module copies the file to the remote host and execute the
> script, so in this case you should use the command module instead and just
> run the script/program since it's already on the Ansible controller.
>
>
> --
> Kai Stian Olstad
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/3163121.aUfRBxzhWJ%40x1.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACecUhuGAQ%3DznUmMk0tY9V2iO%3DAVOez1UhxGUkpPFEhwSosagw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to