Re: [ansible-project] sefcontext restorecon

2017-01-06 Thread Dag Wieers

On Wed, 4 Jan 2017, Andy Mangion wrote:


I am using Ansible 2.2 and wanted to implement a step to set a selinux
context of a file using the sefcontext module. After some work to get it to
work on RHEL 7; it is successfully writing to the local policy file the new
rules I defined however the files are still not getting the updates (doing
ls -Z still shows the old context on the file). Subsequently doing a
restorecon on the files would force restoration of the policy and hence
solve the issue but I was wondering if this should be somehow be included
as functionality of the sefcontext module. Also I see that the module has a
reload option which by default I'm leaving to True what is the purpose of
this option exactly?

I can definitely fix the issue by explicitly running the restorecon command
through ansible, but I would like to understand if there is a better way
which I'm missing.


Hi,

I wrote the sefcontext module.

The sefcontext module is roughly the functionality that 'semanage 
fcontext' provides you. It allows you to add SELinux file context 
mappings to the internal database.


Now, the module is not intended to change file contexts based on the 
mapping, just like 'semanage fcontext' does not do. (See man semanage)


As you said, you can do this with restorecon, or the file module, or 
simply making sure that you first create the required file contexts before 
you start using the locations, in which case the SELinux file contexts 
will be applied automatically to new files.


The reload option is there to reload the SELinux policy after making 
changes. And it is by default turned on because that's what most people 
would expect. (It makes the changes active immediately to be used)


PS If the documentation was confusing, let me know what you would change 
to it to make things more obvious. I am all for improving things !


Kind regards,
--
Dag

--
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/alpine.LRH.2.20.1701070411430.19483%40pikachu.3ti.be.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Package branch specification in openbsd_pkg module vs. package module

2017-01-06 Thread Darren S.
Greetings,

Attempting to understand why this difference exists installing a
package on OpenBSD 6.0 using the more general 'package' module vs. the
underlying installer module 'openbsd_pkg'. The package is given in
format supported for recent version of OpenBSD's package tools where
the branch can be specified using a '%' as the delimiter after package
name, hence below I use 'php%5.6' to install the PHP 5.6 branch from
package repo.

OS: OpenBSD 6.0 amd64
Python: 2.7.12 cpython
Ansible: 2.2.0.0


Value of variable used in tasks:

php_ver: "5.6"

Failure case task:

- name: install php
  package:
name: "{{ item }}"
state: present
  with_items:
- "php%{{ php_ver }}"
  tags: [httpd, web_stack, php]

Result:

TASK [openbsd_httpd : install php]
*

 [119/309]
task path: /etc/ansible/roles/openbsd_httpd/tasks/php.yml:3
Using module file
/usr/local/lib/python2.7/site-packages/ansible/modules/extras/packaging/os/openbsd_pkg.py
 ESTABLISH LOCAL CONNECTION FOR USER: dspruell
 EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
$HOME/.ansible/tmp/ansible-tmp-1483740555.18-20269133733439 `" && echo
ansible-tmp-1483740555.18-20269133733439="` echo
$HOME/.ansible/tmp/ansible-tmp-1
483740555.18-20269133733439 `" ) && sleep 0'
 PUT /tmp/tmpKt3WwN TO
/home/dspruell/.ansible/tmp/ansible-tmp-1483740555.18-20269133733439/openbsd_pkg.py
 EXEC /bin/sh -c 'chmod u+x
/home/dspruell/.ansible/tmp/ansible-tmp-1483740555.18-20269133733439/
/home/dspruell/.ansible/tmp/ansible-tmp-1483740555.18-20269133733439/openbsd_pkg.py
&& sleep 0'
 EXEC /bin/sh -c 'doas  -n  -u root  echo
BECOME-SUCCESS-vuyrqbdqyzccnaxpataiauojdpsybnuw && doas  -n  -u root
env ANSIBLE=true /usr/local/bin/python
/home/dspruell/.ansible/tmp/ansible-tmp-1483740555
.18-20269133733439/openbsd_pkg.py; rm -rf
"/home/dspruell/.ansible/tmp/ansible-tmp-1483740555.18-20269133733439/"
> /dev/null 2>&1 && sleep 0'
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_gFhctJ/ansible_module_openbsd_pkg.py", line 529,
in 
main()
  File "/tmp/ansible_gFhctJ/ansible_module_openbsd_pkg.py", line 511, in main
(rc, stdout, stderr, changed) = package_present(name,
installed_state, pkg_spec, module)
  File "/tmp/ansible_gFhctJ/ansible_module_openbsd_pkg.py", line 180,
in package_present
match = re.search("\W%s-[^:]+: ok\W" % pkg_spec['pkgname'], stdout)
  File "/usr/local/lib/python2.7/re.py", line 146, in search
return _compile(pattern, flags).search(string)
  File "/usr/local/lib/python2.7/re.py", line 251, in _compile
raise error, v # invalid expression
sre_constants.error: bad character range

failed: [molodetz] (item=[u'php%5.6']) => {
"failed": true,
"invocation": {
"module_args": {
"name": [
"php%5.6"
],
"state": "present"
},
"module_name": "package"
},
"item": [
"php%5.6"
],
"module_stderr": "Traceback (most recent call last):\n  File
\"/tmp/ansible_gFhctJ/ansible_module_openbsd_pkg.py\", line 529, in
\nmain()\n  File
\"/tmp/ansible_gFhctJ/ansible_module_openbsd_pkg$
py\", line 511, in main\n(rc, stdout, stderr, changed) =
package_present(name, installed_state, pkg_spec, module)\n  File
\"/tmp/ansible_gFhctJ/ansible_module_openbsd_pkg.py\", line 180, in
package_present\$
match = re.search(\"\\W%s-[^:]+: ok\\W\" % pkg_spec['pkgname'],
stdout)\n  File \"/usr/local/lib/python2.7/re.py\", line 146, in
search\nreturn _compile(pattern, flags).search(string)\n  File
\"/usr/loc$
l/lib/python2.7/re.py\", line 251, in _compile\nraise error, v #
invalid expression\nsre_constants.error: bad character range\n",
"module_stdout": "",
"msg": "MODULE FAILURE"
}


Success case task:

- name: install php
  openbsd_pkg:
name: "{{ item }}"
state: present
  with_items:
- "php%{{ php_ver }}"
  tags: [httpd, web_stack, php]

Result:

TASK [openbsd_httpd : install php] *
task path: /etc/ansible/roles/openbsd_httpd/tasks/php.yml:10
Using module file
/usr/local/lib/python2.7/site-packages/ansible/modules/extras/packaging/os/openbsd_pkg.py
 ESTABLISH LOCAL CONNECTION FOR USER: dspruell
 EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo
$HOME/.ansible/tmp/ansible-tmp-1483740920.56-228683905932090 `" &&
echo ansible-tmp-1483740920.56-228683905932090="` echo
$HOME/.ansible/tmp/ansible-tmp-1483740920.56-228683905932090 `" ) &&
sleep 0'
 PUT /tmp/tmpC7ojNJ TO
/home/dspruell/.ansible/tmp/ansible-tmp-1483740920.56-228683905932090/openbsd_pkg.py
 EXEC /bin/sh -c 'chmod u+x
/home/dspruell/.ansible/tmp/ansible-tmp-1483740920.56-228683905932090/
/home/dspruell/.ansible/tmp/ansible-tmp-1483740920.56-228683905932090/openbsd_pkg.py
&& sleep 0'
 EXEC /bin/sh -c 'doas  -n  -u root  echo
BECOME-SUCCESS-kvaawdyqduryzxrfqymiuyjlxckasuuy && doas  -n  -u root
env ANSIBLE=true /

Re: [ansible-project] Using lookup plugin within include_vars to build file name

2017-01-06 Thread Johannes Kastl
On 05.01.17 21:43 Sam Sen wrote:
> Running Ansible 2.1.1
> 
> I want to dynamically build the variable name for a file I wish to
> load using "include_vars." it doesn't work using the lookup plugin
> but the lookup plugin itself does work when I use the "debug"
> method.

Can you workaround it by setting a variable to the result of your
lookup and then use this variable for the file name?

Johannes

-- 
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/e9f1fb44-1013-bb94-a4ca-8245366c67b1%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] digital_ocean module and host_vars

2017-01-06 Thread Johannes Kastl
On 05.01.17 17:07 Jerry Steele wrote:

> - debug: msg: {{ my_droplet.droplet.ip_address }

1. You are missing the second closing curly bracket.

2. Does using this help?
- debug: var=my_droplet
- debug: var=my_droplet.droplet
- debug: var=my_droplet.droplet.ip_address

3. Sure you have not mixed up ip and id somewhere:
"The error was: 'dict object' has no attribute 'id'"

What's in "/my/path/digitalocean.yml': line 33, column 7"? Anything
that hits your eye?

Johannes

-- 
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/37b9e4a4-a597-dd48-af88-0afb278e8268%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


Re: [ansible-project] how to synchronize files or Dir between different remote hosts?

2017-01-06 Thread Johannes Kastl
On 05.01.17 09:30 张利高 wrote:
> how to synchronize files or Dir between different remote hosts? 
> 
> if there are 2 hosts: s1 and s2, and ansible running at s3,
> how to synchronize dirs on s1 and s2?

First thought: Sync from s1 to s3 (put it somewhere on the controller)
and then sync this to s2.

Syncing directly via e.g. rsync might cause trouble with ssh-keys,
agents and stuff like that.

But I never had the need to actually do this, maybe someone else
already has...

Johannes

-- 
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/0a8cb864-a46c-d0c9-c91b-ff600c61d68c%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: OpenPGP digital signature


[ansible-project] Re: wait_for_ip_address timeout in vmware_guest module

2017-01-06 Thread Neil Watson

A  quick update on this. I set the timeout to 10min and I still get some 
host info with ipv4 set to null, even though the vm does have an ipv4 
address. How can I work around this?

-- 
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/fa9d1d26-ead0-4e65-9f7b-a31e510895ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Automate sphinx installation on multiple servers using Ansible

2017-01-06 Thread Matt Martz
Using the `pip` module should work:

- name: Install Sphinx
  pip:
name: sphinx
state: latest

On Fri, Jan 6, 2017 at 11:15 AM, Vincent  wrote:

> I would like to automate sphinx installation on multiple servers using
> Ansible.
> Can you anyone send the procedure to accomplish this task?
>
> --
> 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/27ff47b9-cb89-4483-843e-ef2f44b8becd%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v-A4VALeB0Xfh%3DDXjECfYad%2BJaNvzM5%2BY%2BYMKMDF5LFBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Automate sphinx installation on multiple servers using Ansible

2017-01-06 Thread Vincent
I would like to automate sphinx installation on multiple servers using 
Ansible.
Can you anyone send the procedure to accomplish this task?

-- 
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/27ff47b9-cb89-4483-843e-ef2f44b8becd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Invalid input detected at '^' marker (Ansible 2.2 using ios_config)

2017-01-06 Thread Peter Sprygada
hm thats strange. i dont see anything glaringly obvious.  I see it fails to
execute the command "configure terminal".  What version of IOS are you
running against?  Is AAA involved?  Can you replicate the steps manually
when logged via the same user/password combination?

On Tue, Dec 27, 2016 at 2:57 PM, Kyle Patton  wrote:

> ---
>
> - name: provider for logging into switches / routers
>   set_fact:
> cli:
>   host: "{{ inventory_hostname }}"
>   username: "{{ ios_username }}"
>   password: "{{ ios_password }}"
>   auth_pass: "{{ ios_password }}"
>   authorize: yes
>   no_log: True
>
>
> - name: force push a configuration onto the device
>   ios_config:
> src: test.j2
> match: none
> provider: "{{ cli }}"
>
>
> test.j2 contains the following
>
> interface Gi5/8
> shutdown
>
> "msg": "matched error in response: configure terminal\r\n
> ^\r\n% Invalid input detected at '^' marker.
>
> --
> 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/134e298a-b1e8-4eec-90d1-98a2ce2073a6%40googlegroups.
> com
> 
> .
> 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/CAEkdrMiN-PqDwcRSz_yCKwvxL8JVtiHcOQGjxKX0db5xp1AdUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] ios_command module fails to enter previledge mode

2017-01-06 Thread Peter Sprygada
Use iosxr_command not ios_command when configuring IOS-XR devices

On Wed, Dec 21, 2016 at 3:09 PM, Eliezer Rodriguez 
wrote:

> Hi,
>
> I'm using the ios_command and it seems it's not entering privileged mode,
> the traceback shows it issuing a "term length 0" commands that fails,
> because it's being issued in EXEC mode I believe.
>
> The trace follows:
>
>  An exception occurred during task execution. The full traceback is:
> Traceback (most recent call last):
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_module_ios_command.py", line 237, in 
> main()
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_module_ios_command.py", line 200, in main
> runner.add_command(**cmd)
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/netcli.py",
> line 147, in add_command
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py",
> line 117, in cli
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py",
> line 148, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/ios.py", line
> 181, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 153, in send
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 139, in receive
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 186, in find_prompt
> ansible.module_utils.shell.ShellError: matched error in response:
> terminal length 0
> ^
> % Invalid input detected at '^' marker.
>
> m1.dca2>
>
> fatal: [m1.dca2.plx]: FAILED! => {
> "changed": false,
> "failed": true,
> "invocation": {
> "module_name": "ios_command"
> },
> "module_stderr": "Traceback (most recent call last):\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_module_ios_command.py\",
> line 237, in \nmain()\n  File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_module_ios_command.py\",
> line 200, in main\nrunner.add_command(**cmd)\n  File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/netcli.py\", line 147, in add_command\n
> File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 117, in cli\n  File \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_d49Dnv/ansible_modlib.zip/ansible/module_utils/network.py\",
> line 148, in connect\n  File \"/var/folders/f6/
> j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/ios.py\", line 181, in connect\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 153, in send\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 139, in receive\n  File
> \"/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l/T/ansible_d49Dnv/ansible_
> modlib.zip/ansible/module_utils/shell.py\", line 186, in
> find_prompt\nansible.module_utils.shell.ShellError: matched error in
> response: terminal length 0\r\n^\r\n% Invalid input detected at '^'
> marker.\r\n\r\nm1.dca2>\n",
> "module_stdout": "",
> "msg": "MODULE FAILURE"
> }
> An exception occurred during task execution. The full traceback is:
> Traceback (most recent call last):
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_module_ios_command.py", line 237, in 
> main()
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_module_ios_command.py", line 200, in main
> runner.add_command(**cmd)
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/netcli.py",
> line 147, in add_command
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py",
> line 117, in cli
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/network.py",
> line 148, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/ios.py", line
> 181, in connect
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00132l
> /T/ansible_js6YVM/ansible_modlib.zip/ansible/module_utils/shell.py", line
> 153, in send
>   File "/var/folders/f6/j40sztrd7639grsx4ghg8b8c00

Re: [ansible-project] ENCOUNTERING MODULE FAILURE Error while using IOS_template module

2017-01-06 Thread Peter Sprygada
template files need to be structured as config files.  shubham.j2 should
look like this:

interface FastEthernet0/0
 ip address 1.1.1.1 255.255.255.0
 no shutdown

With indents... no need to add configure terminal as the module will handle
that for you

On Fri, Jan 6, 2017 at 4:48 AM,  wrote:

> Hello,
>
>   I am writing simple playbook to add configuration in Cisco 2800
> router using jinja2 templates,Where I am able to generate Configuration
> file using Template module.But after generating the configuration file i.e.
> shubham.J2  i am getting the following  error while pushing configurations
> to device.
>
> An exception occurred during task execution. To see the full traceback,
> use -vvv. The error was: cnlabs(config)#
> fatal: [192.168.3.65]: FAILED! => {"changed": false, "failed": true,
> "module_stderr": "Traceback (most recent call last):\n  File
> \"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\", line 174, in
> \nmain()\n  File 
> \"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\",
> line 165, in main\nresponse = module.config(commands)\n  File
> \"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/netcfg.py\",
> line 54, in __call__\n  File \"/tmp/ansible_HV_5qu/ansible_
> modlib.zip/ansible/module_utils/ios.py\", line 194, in configure\n  File
> \"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/shell.py\",
> line 250, in execute\nansible.module_utils.network.NetworkError: matched
> error in response: configure terminal\r\n ^\r\n%
> Invalid input detected at '^' marker.\r\n\r\ncnlabs(config)#\n",
> "module_stdout": "", "msg": "MODULE FAILURE"}
>
>  my configuration file looks like:(shubham.j2)
>
> configure terminal
> interface fastEthernet 0/0
> ip address 1.1.1.1 255.255.255.0
> no shutdown
> exit
>
>   Using this configuration file I am trying to assign the above mentioned
> IP address to Fa 0/0 interface of my cisco device. And I am using
> ios_template module in my playbook to push configurations in to Device.Can
> anyone help me to solve this error.
>
> --
> 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/5063a923-be72-4af7-852c-7eb67bc360ff%40googlegroups.
> com
> 
> .
>
> 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/CAEkdrMhHZ_b3gGEeTnBghu%2Bt6X%3DjPXVqdV0ScfmnoVARBTyJgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Polling URL using 'until' loop - how to get feedback during the loop

2017-01-06 Thread Brian Coca
There was a bug on displaying retries, that should have been fixed in
current versions.


--
Brian Coca

-- 
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/CACVha7dmnis-4igH3N5YAKOM5wg7Rcd2SRbGBFOcWbdFs8%3D%3DkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ENCOUNTERING MODULE FAILURE Error while using IOS_template module

2017-01-06 Thread sgampawa
Hello,

  I am writing simple playbook to add configuration in Cisco 2800 
router using jinja2 templates,Where I am able to generate Configuration 
file using Template module.But after generating the configuration file i.e. 
shubham.J2  i am getting the following  error while pushing configurations 
to device.

An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: cnlabs(config)#
fatal: [192.168.3.65]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "Traceback (most recent call last):\n  File 
\"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\", line 174, in 
\nmain()\n  File 
\"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\", line 165, in 
main\nresponse = module.config(commands)\n  File 
\"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/netcfg.py\", 
line 54, in __call__\n  File 
\"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/ios.py\", 
line 194, in configure\n  File 
\"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/shell.py\", 
line 250, in execute\nansible.module_utils.network.NetworkError: matched 
error in response: configure terminal\r\n ^\r\n% 
Invalid input detected at '^' marker.\r\n\r\ncnlabs(config)#\n", 
"module_stdout": "", "msg": "MODULE FAILURE"}

 my configuration file looks like:(shubham.j2)

configure terminal
interface fastEthernet 0/0
ip address 1.1.1.1 255.255.255.0
no shutdown
exit

  Using this configuration file I am trying to assign the above mentioned 
IP address to Fa 0/0 interface of my cisco device. And I am using 
ios_template module in my playbook to push configurations in to Device.Can 
anyone help me to solve this error. 

-- 
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/5063a923-be72-4af7-852c-7eb67bc360ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] ioc_template Module Failure

2017-01-06 Thread Shubham Gampawar
Hello, 

 I am using Ansible 2.2 to automate Cisco 2800 router in that I am 
generating configurations using Jinja2 templates.It is generating 
configuration file to respective destination folder. when pushing that 
configurations to my router I am getting following error:

An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: cnlabs(config)#
fatal: [192.168.3.65]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "Traceback (most recent call last):\n  File 
\"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\", line 174, in 
\nmain()\n  File 
\"/tmp/ansible_HV_5qu/ansible_module_ios_template.py\", line 165, in 
main\nresponse = module.config(commands)\n  File 
\"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/netcfg.py\", 
line 54, in __call__\n  File 
\"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/ios.py\", 
line 194, in configure\n  File 
\"/tmp/ansible_HV_5qu/ansible_modlib.zip/ansible/module_utils/shell.py\", 
line 250, in execute\nansible.module_utils.network.NetworkError: matched 
error in response: configure terminal\r\n ^\r\n% 
Invalid input detected at '^' marker.\r\n\r\ncnlabs(config)#\n", 
"module_stdout": "", "msg": "MODULE FAILURE"}
 

This are the configurations which are generated in my shubham.j2 file 

configure terminal
interface fastEthernet 0/0
ip address 1.1.1.1 255.255.255.0
no shutdown
exit

here I am trying to push the above IP Address to FastEthernet 0/0 port of 
my cisco 2800 router. Is that error is because of module failure ?, Can 
anyone help me to resolve this error .

-- 
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/793bbbaf-be50-499f-af1f-e1207abc395d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Polling URL using 'until' loop - how to get feedback during the loop

2017-01-06 Thread Dick Visser
Hi

My playbook imports a backup that takes a while, and that needs to be
finished before I continue with the rest.
I have created this task:

- name: "Poll backup import process"
  uri: url=http://localhost:8090/setup/longrunningtaskxml.action?taskId={{
taskid }}
HEADER_Cookie="{{ wizard.set_cookie }}"
status_code=200
return_content=yes
  register: longrunner_status
  until: "'Complete.' in
longrunner_status.content"
  delay: 5
  retries: 1000


This works great.
But, during this task there is no output.
And because it takes a while, with lots of retries, the screen is
empty after a while, so it's hard to tell what's happening.

Is there a way to have output during the loop?

Thanks




-- 
Dick Visser
Sr. System & Network Engineer
GÉANT

Want to join us? We're hiring: http://www.geant.org/jobs

-- 
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/CAEQQDN%3Dzu-P%3Dea0RFOX6%3D2b3s9bx1UBmEPkCtee74vnZfyU-qg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] The setup task to windows machine hangs

2017-01-06 Thread Deepa Yr
Hi

  At some point of time in the execution of playbooks, it hangs at 
the setup task  with windows machine. It does not send the response back to 
ansible controller I guess, and playbook hangs. in windows machine, i see 
powershell command running as back ground process and in temp directory I 
see ansible folder with a file named source.

What can be done to avoid such connection issues from occurring.

looking for help

Thanks
Deepa

-- 
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/a49b7eeb-d859-443f-9c62-60b4077b237d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Install EXE on Windows

2017-01-06 Thread 'J Hawkesworth' via Ansible Project
Hello,

Here are some examples of using DCOMPERM.EXE to grant dcom permissions to a 
domain user.

You'll need to find a copy of DCOMPERM.exe from somewhere.  I believe it is 
included as source code in Windows SDKs but I think I just found a compiled 
version somewhere and downloaded it.  In the examples {{ deploy_dir }} is a 
folder on the windows machine where I put software components to be 
installed.  Its pretty small so can probably be installed via win_copy 
module.  Once you have DCOMPERM.exe on your windows targets here are the 
examples.

- name: run Dcomperm to allow domain user launch
  raw: "{{ deploy_dir }}DComPerm.exe -dl set {{ win_domain }}\\{{ win_user 
}} permit level:l,r"

- name: run Dcomperm to allow domain user activation
  raw: "{{ deploy_dir }}DComPerm.exe -da set {{ win_domain }}\\{{ win_user 
}} permit level:l,r"

- name: run Dcomperm to allow dcom component to specified by CLSID to 
launch as domain user
  raw: "{{ deploy_dir }}DComPerm.exe -al 
0AF3D1B3-2476-4635-6B27-13599AE7F248 set {{ win_domain }}\\{{ win_user }} 
permit level:r"

If you can find a system where your exe is installed successfully you might 
be able to find the dcom permissions you need by using the DCOMCNFG.EXE 
program.  Browse to Component services -> My Computer, right click and 
choose Properties, and switch to COM Security tab, then check all the 
Defaults and Limits.  Then browse to to Component services -> DCOM Config 
and find the dcom component you are interested in (if you don't know the 
name of it you can try searching through the registry for the CLSID - the 
component name will likely be in the parent key or nearby).  Once you have 
found the dcom component, right click and choose properties and click on 
the Security tab, and check all of the permissions are correct.

DCOM stuff is rather old now and I found it hard to get information on it 
that wasn't intended for programmers.

Hope this helps,

Jon

On Thursday, January 5, 2017 at 9:39:47 AM UTC, Ansible_Red wrote:
>
> Hi Hawkesworth,
>
> It would be great if you could show me something related to this with the 
> RAW module.
>
> Kr,
>
> Op woensdag 4 januari 2017 20:50:28 UTC+1 schreef J Hawkesworth:
>>
>> Sounds like the application you are trying to install contains a dcom 
>> component. You might need to find a copy of dcomperm.exe and use it to 
>> grant launch and activation to the user you are running as, or possibly to 
>> the user that the dcom component is configured to run as.
>>
>> I can dig out some examples of using dcomperm.exe to do something similar 
>> if you need.  Check the documentation for the exe to find out what dcom 
>> permissions it needs.
>>
>> My guess would be that the app is expecting to run as an interactive 
>> user, which you wont be running as under winrm, so you'll probably need to 
>> grant explicit dcom permissions before attempting to install.
>>
>> I can dig out some examples of using dcomperm.exe via raw module if you 
>> need.
>>
>> Hope this helps,
>>
>> Jon
>>
>>

-- 
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/2d478357-8a54-45f2-8bcb-7d05965ef335%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.