[ansible-project] item as part of a variable

2018-04-16 Thread Michael Renner
Moin,

I'm calling a playbook (ansible 2.4.2.0) with extra-vars for 3 system 
components, e.g. "foo_version=0.11.3 bar_version=0.10.2 baz_version=0.12.1 
env=dev".

There is a statement In the playbook that takes care that this step is only 
executed if the corresponding variable is defined: "{{ item }}_version".

  - name: copy war file
copy:
  src: "{{ tmpdir.path }}/{{ item }}.war"
  dest: /opt/tomcat/webapps/
  owner: tomcat
  group: root
  mode: 0440
when:
  - "{{ item }}_version" is defined
with_items:
  - foo
  - bar
  - baz

But this fail:

The offending line appears to be:

  - "{{ item }}_version" is defined
 ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.

How can I check if the variable is set?

Thanks

-- 
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/9f32f0fa-0748-41e5-a19f-ccbfa0af20cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Using subversion via http?

2018-04-16 Thread Michael Renner
Just for the archive: "become: no" was my friend.

Am Freitag, 13. April 2018 17:26:05 UTC+2 schrieb Michael Renner:
>
> Moin,
>
> a simple playbook won't work:
>
>   - name: svn checkout
> subversion:
>
> [...]

CU 

-- 
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/b96afed0-7622-4aa2-8b70-9917979e89df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Using subversion via http?

2018-04-13 Thread Michael Renner
Moin,

a simple playbook won't work:

  - name: svn checkout
subversion:
  repo: http://svn-01.int.de/operation/foobar
  dest: /tmp/checkout
delegate_to: localhost

but it fail:
TASK [svn checkout] 
*
fatal: [server.local -> localhost]: FAILED! => {"changed": false, "cmd": 
"/usr/local/bin/svn --non-interactive --trust-server-cert --no-auth-cache 
checkout -r HEAD http://svn-01.int.de/operation/foobar /tmp/checkout", 
"msg": "svn: OPTIONS of 'http://svn-01.int.de/operation/foobar': 
authorization failed: Could not authenticate to server: rejected Basic 
challenge (http://svn-01.int.de)", "rc": 1, "stderr": "svn: OPTIONS of 
'http://svn-01.int.de/operation/foobar': authorization failed: Could not 
authenticate to server: rejected Basic challenge (http://svn-01.int.de)\n", 
"stderr_lines": ["svn: OPTIONS of 'http://svn-01.int.de/operation/foobar': 
authorization failed: Could not authenticate to server: rejected Basic 
challenge (http://svn-01.int.de)"], "stdout": "", "stdout_lines": []}

There is no password protection, it's also possible to check out the 
repository by
/usr/local/bin/svn --non-interactive --trust-server-cert --no-auth-cache 
checkout -r HEAD http://svn-01.int.de/operation/foobar /tmp/checkout
in a shell.

What may be wrong?

Thanks for answers!

-- 
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/ff451692-f865-428b-b39f-191e3faba954%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] create tepdir and copy file into it?

2018-04-11 Thread Michael Renner
Moin,

[...]
 

>
> If I understand you correctly you want to download to localhost, and then 
> copy it out to all the host in the play. 
> If so you need to add run_once and delegate_to. you need to add run_once 
> and delegate_to


[...]

CU 

-- 
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/3cb6fd1b-c821-45a4-b268-2d8710318ab2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] create tepdir and copy file into it?

2018-04-10 Thread Michael Renner
Moin,

I want to download a file using the maven_artifact plugin into a temporary 
directory (an copy this to several other maschines). Now I wonder how to 
use a registerd variable for this .


  - name: create temporary build directory
tempfile:
  state: directory
  suffix: _baz

  - name : download Artifacts
maven_artifact:
  group_id: "com.foo.bar.baz"
  artifact_id: "baz-application"
  extension: "war"
  repository_url: 
"http://int-maven-01:8081/nexus/service/local/repositories/releases/content/;
  validate_certs: no
  version: "0.0.3"
  username: ""
  password: ""
  dest: ""
 
  - name: copy war file
   copy:
   src:?
   dest: /opt/tomcat/webapp/
 owner: tomcat
 group: root
 mode: 0440


How do I get the name of the directory? How can I use this to the dest and 
src fields?

Thanks

-- 
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/37f65ce7-db06-4f52-aa26-59c78e88e38a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.