[ansible-project] win_part and win_volume.

2018-02-19 Thread Varun Chopra
Is there a plan to implement modules for cmdlets like *-Partition, *-Volume? 


Or I guess they're already there and I'm missing something. o_O

-- 
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/5733b391-318b-4cd7-8cbf-fb65e495fbc0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Get info from a host, and use it in another host's template

2018-02-19 Thread Kai Stian Olstad

On 17.02.2018 23:20, Brigzzy Briggs wrote:

I tried that, but it didn't work.  Thanks for the reply all the same!

Here's the section of the playbook.  Let me know if you can see the 
issue,

or if I can post anything else that would help.

- hosts: nagios-server
  become: yes
  tasks:

- name: Generate Configs
  template:
src=skins/larry/root/ansible/ansible-files/nagios/nagios-monitored-server.cfg.j2
dest=/usr/local/nagios/etc/servers/{{ item }}.cfg owner=root mode=0644
  with_items: "{{groups['nagios-monitored']}}"
.

This is the error the playbook spits out.  It throws it for all the
servers, not just the FreePBX one.

failed: [nagios.domain.com] (item=freepbx.domain.com) => {"failed":
true, "item": "freepbx.domain.com", "msg": "AnsibleUndefinedVariable:
'dict object' has no attribute 'ansible_os_family'"}


You don't have access to the facts the hosts in group nagios-monitored, 
that's the reason it fails.


So you need to enable fact caching
http://docs.ansible.com/ansible/latest/playbooks_variables.html#fact-caching

or gather the facts before you run the nagios-server play.
Facts gathered in one play is available in subsequent plays as long as 
they are in the same playbook.


---
- hosts: nagios-monitored
  gather_facts: yes

- hosts: nagios-server
  become: yes
  tasks:

- name: Generate Configs


--
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/433db1c9c9a30f72711b5df03d726a16%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Getting error while creating group or host

2018-02-19 Thread Samurdhi Senanayake



I have installed ansible tower on CentOS 7. I am getting error message 
while I am creating host or group. Please advice.



Ansible Version :*ansible 2.4.0.0*


CentOS : *CentOS Linux release 7.4.1708 (Core)*



Error message when creating group :  *Call to /api/v2/Groups/ .Get 
returned: 500 A server error has occurred.  *


Error message when creating host: *Call to /api/v2/hosts/ .Get returned: 
500 A server error has occurred.*  


*Please see below screen shots*









 



-- 
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/29d461b4-34cb-46f7-be2e-da526a60c10d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] import_tasks and import_playbook in a single .yml file

2018-02-19 Thread Brian Coca
like this:

- hosts: 
  tasks:
 - import_tasks: mytasks.yml

- import_playbook: myplaybook.yml

-- 
--
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/CACVha7fiO8wvTMjJA9gkx0A2KD0MhyyGSXTJS%2B1D7yetVLDpOQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Release schedule for 2.4.4 and beyond

2018-02-19 Thread Toshio Kuratomi
Greetings all,

I just wanted to say a brief word about my intention as the 2.4.x
Ansible Release Manager forgetting 2.4.4 out the door and any further
2.4.x releases after that.

Release Schedule for 2.4.4
==

My plan is for 2.4.4 to be released shortly after 2.5.0 final is
released. To get us on the right track for that, I'll be releasing
2.4.4 beta1 when 2.5.0-rc1 is released. My plan is for just one beta
and then begin rc's for 2.4.4 as there are relatively fewer changes
hitting the 2.4 tree now. Here's the tentative release schedule:

February 21: 2.4.4-beta1
March 28: 2.4.4-rc1

2.4.4 final could potentially land as early as March 7th but I'll
definitely wait until 2.5.0 final is out before shipping 2.4.4 final.
There's enough code in common that it just makes sense to wait until
all of the bugs we're going to consider blockers for 2.5.0 are taken
care of before releasing 2.4.4 (in case any of them need backporting
to 2.4.4)

Beyond 2.4.4


So far, the 2.4.x release series has had a series of scheduled
releases. 2.4.1 and 2.4.2 were each scheduled for one month after the
previous releases. 2.4.3 was scheduled for two months after its
predecessor but slipped a few extra weeks. 2.4.4 will be the last of
these scheduled
releases. After it is released we'll continue to accumulate important
bugfixes in the stable-2.4 branch but will only be cutting a 2.4.5 if
there's any critical or security bugs that need to be addressed. If
that happens, I'll make one or more release candidate tarballs
followed by a new 2.4.x release that addresses the critical bug.

Thanks everyone, and looking forward to a smooth 2.4.4 release :-)

-Toshio

-- 
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/CAPrnkaRmtxA52Ne4KbRgZ63XuszcCOmv8YsyjwER8ipm5tG-%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Need help about Ansible block syntax

2018-02-19 Thread Brian Coca
'tasks' is a property of a play, it should ONLY appear at the play level





-- 
--
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/CACVha7dXBV2XZ%2BMdmHwPOJpAbiA6yiYH_9%3DHu6JTujSVynX%3Dew%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] nice yum output

2018-02-19 Thread Willem D'Haese
Hello,

I'm trying to find a way to list all updated yum packages after:

- name: Upgrade all packages
  yum:
name: '*'
state: latest
  register: yumupdateoutput


Tried many combinations such as:

- debug:
var: yumupdateoutput.results[0]
  ignore_errors: true


- debug:
var: yumupdateoutput.results[0].split('/n')
  ignore_errors: true


- debug:
msg: "{{yumupdateoutput.results[0].split('/n')}}"
  ignore_errors: true

But neither gets me any closer to what I would really want, a clean list of 
all updated packages,with proper newlines instead of '\n''s.

Grtz

Willem

-- 
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/57b9f8da-6dfc-42af-a0d7-49206f1c9fa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Get info from a host, and use it in another host's template

2018-02-19 Thread Brigzzy Briggs
Hi Kai,

I tried that, but it didn't work.  Thanks for the reply all the same!

Here's the section of the playbook.  Let me know if you can see the issue, 
or if I can post anything else that would help.

- hosts: nagios-server
  become: yes
  tasks:

- name: Generate Configs
  template: 
src=/root/ansible/ansible-files/nagios/nagios-monitored-server.cfg.j2 
dest=/usr/local/nagios/etc/servers/{{ item }}.cfg owner=root mode=0644
  with_items: "{{groups['nagios-monitored']}}"
.

This is the error the playbook spits out.  It throws it for all the 
servers, not just the FreePBX one.  

failed: [nagios.domain.com] (item=freepbx.domain.com) => {"failed": true, 
"item": "freepbx.domain.com", "msg": "AnsibleUndefinedVariable: 'dict object' 
has no attribute 'ansible_os_family'"}


Thanks again!

On Saturday, 17 February 2018 13:22:12 UTC-8, Kai Stian Olstad wrote:
>
> On Saturday, 17 February 2018 21.44.06 CET Brigzzy Briggs wrote: 
> > I can see that 
> > 
> > 
> > "ansible_os_family": "Sangoma" 
> > 
> > In my template, I have the following if statement: 
> > 
> > 
> > {% if ansible_os_family == "Debian" or ansible_os_family == "Ubuntu" %} 
> > define service{ 
> > use local-service 
> > host_name   {{ 
> hostvars[item].inventory_hostname 
> > }} 
> > service_description Apt Status 
> > check_command   check_apt 
> > } 
> > {% endif %} 
> > 
> > and the issue is that the block is still being generated for that 
> server, 
> > even though it's not Debian or Ubuntu. 
> > 
> > 
> > I posted this on Reddit as well 
> > <
> https://www.reddit.com/r/ansible/comments/7y5uje/troubles_with_an_if_statement_in_a_jinja2_template/?st=jdrthmo2=38998e5f>,
>  
>
> > and I realized that the issue is that the template is being applied to 
> my 
> > Nagios server, which is Debian, so the ansible_os_family is always 
> coming 
> > back Debian.  What I'm having trouble with is how to get the if 
> statement 
> > to get it's facts from the target server, and not the one the playbook 
> is 
> > running on.  I'm able to get the hostname from the static hosts file 
> like 
> > this 
> > 
> > 
> > {{ hostvars[item].inventory_hostname }} 
> > 
> > but I'm not having any luck figuring out how to get the template to 
> apply 
> > to the values from that host.  Anyone have any ideas? 
>
> Without the more of the code on where and how you are generating the 
> template it's difficult to say, but I believe you are looking for this 
>
> {% if hostvars[item].ansible_os_family == "Debian" or 
> hostvars[item].ansible_os_family == "Ubuntu" %} 
>
> or the more cleaner version 
>
> {% if hostvars[item].ansible_os_family in ['Debian', 'Ubuntu'] %} 
>
> -- 
> 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/acfbf84b-8cbc-43b4-9161-e011a336a2e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] passing values while installing packages

2018-02-19 Thread sureshmadapathii
hi All,

while in stalling packages there are values we need to pass, how to pass 
those on commandline/runtime .

ex: [y/n]
  [db name]:
  [option 3?]: 

-- 
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/6571ec0f-a92c-4bfb-b8bb-f7ec68603791%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Help with blockinfile module running against Proxmox

2018-02-19 Thread saicrazyfire
Hi,

I'm trying to create containers in Proxmox via ansible and I've gotten most 
of it working. I'm leveraging LXC containers to host Docker containers 
(since they're more lightweight, and easier to create). In order to do so, 
I need to append a few lines in the configuration of the container.

Let's say I'm creating a LXC container with ID 100, the following lines 
needs to be added to /etc/pve/lxc/100.conf (courtesy 
of https://gist.github.com/kvaps/25f730e0ec39dd2e5749fb6b020e71fc)

lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop: 
lxc.mount.auto: proc:rw sys:rw


I have the following task in Ansible

- name: Add configs to LXC for Docker via Proxmox host cfg files
become: true
blockinfile:
path: "/etc/pve/lxc/{{ item }}.conf"
block: |
lxc.apparmor.profile: unconfined
lxc.cgroup.devices.allow: a
lxc.cap.drop: 
lxc.mount.auto: proc:rw sys:rw
with_items:
- 100

but I get this error

TASK [Add configs to LXC for Docker via Proxmox host cfg files] 

An exception occurred during task execution. To see the full traceback, use 
-vvv. The error was: OSError: [Errno 1] Operation not permitted: 
'/etc/pve/lxc/.ansible_tmp8TEvvY100.conf'
failed: [192.168.1.6] (item=100) => {"changed": false, "item": 100, "msg": 
"Failed to replace file: /tmp/tmpuptjyz to /etc/pve/lxc/100.conf: [Errno 1] 
Operation not permitted: '/etc/pve/lxc/.ansible_tmp8TEvvY100.conf'"}

Any help would be appreciated. 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/d3a553e6-9a12-4e34-9b6f-23d9fad28199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible Failover of SQL Database

2018-02-19 Thread Darren Rucker
Hi folks. I am pretty new to Ansible though have been assigned a project to 
failover a Microsoft SQL database from a primary data center to a DR site. 
What I an uncertain of is how to structure that's below in Ansible and 
execute the sql scripts remotely. Would anyone be able to help here? Would 
anyone have a module/modules to use to accomplish all of this?

//Stop application
-stop iis on servers a, b and c
-stop windows services on servers d, e, and f
-stop scheduled tasks on servers d, e, and f

//No pending transactions replicating
-execute a SQL script(to check if any replication is in flight) on DB 
server G
-if records in queue =0, continue. If query returns anything other than 0, 
wait 30 seconds and rerun the query. Needs to be 0 before continuing

//Stop log reader agent and drop publications and subscriptions
-execute SQL script on server G to stop log reader agent 
-execute SQL script on server G to drop replication publications 
-execute SQL script on server H to drop all replication subscriptions
-execute SQL script on server I to drop all replication subscriptions
-execute SQL script on server J to drop all replication subscriptions

//Failover Databases
-execute SQL script to failover databases from primary to dr

Configure replication
-execute SQL script on server G to create replication publications 
-execute SQL script on server H to create all replication subscriptions
-execute SQL script on server I to create all replication subscriptions
-execute SQL script on server J to create all replication subscriptions

Thank you in advance. 

-- 
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/2f9796cb-3d60-4e51-8f83-9b61a435e6bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] passing command line arguments

2018-02-19 Thread sureshmadapathii
 

---

 

- hosts: all

  become: yes

 

  tasks:

- name: create an empty folders

  import_tasks: /etc/ansible/foldercreation.yml

- name: Copy rpm file to server

  copy:

 src: "{{ item }}"

 dest: /home/user/ansible/rpmpackages/

  with_fileglob:

- /home/user/ansible/rpmpackages/*

- name: copy the dynatrace file from home to root

  shell: sudo mv 
/home/user/ansible/rpmpackages/dynatrace-agent-6.1.0.7880-unix.jar 
/compuware/dt/

  shell: sudo chmod -R 755 
/compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar

  shell: sudo chown -R user 
/compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar

- name: install dynatrace

  expect:

command: /opt/SecureSpan/JDK/bin/java -jar 
/compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar -installDir /compuware/dt/

responses:
   The product will be installed to /compuware/dt/dynatrace-6.1.0. 
Do you want to install to this directory? \(Y/N\): 'Y'


for dynatarce installation I am getting below error , what could  be the 
reason

TASK [install dynatrace] 
***
task path: /etc/ansible/installrpm.yml:28
changed: [server] => {"changed": true, "cmd": "/opt/SecureSpan/JDK/bin/java 
-jar /compuware/dt/dynatrace-agent-6.1.0.7880-unix.jar -installDir 
/compuware/dt/", "delta": "0:00:00.183363", "end": "2018-02-19 
13:33:46.355043", "rc": 0, "start": "2018-02-19 13:33:46.171680", "stdout": 
"Invalid argument given!\r\n use  -h to list all the available 
arguments", "stdout_lines": ["Invalid argument given!", " use  
-h to list all the available arguments"]}
META: ran handlers
META: ran handlers

-- 
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/080ffc57-a0c1-4168-ab95-16758edc89b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Seeking testers for a (radically) performance-improving Ansible plug-in

2018-02-19 Thread Brian Coca
So during vacation i was toying with an 'ansible remote execution'
(rme) https://github.com/bcoca/ansible/tree/rme ,  via a connection
plugin that requires Ansible be installed on the target node.

It could either have a service/socket/trigger to run ansible tasks as
passed in or we can just execute `ansible -m module ...` directly.

This avoids 'cache invalidation issues' but does introduce version
mismatch ones as well as 'agent or required software' on the targets.
More thorny issues are 'what do we pass', templated task? task loop?
original task + vars? what secrets do we pass and how?

I have not seen an approach that does not have drawbacks, in the end
we might implement more than one and let the user choose their
tradeoffs.


--
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/CACVha7c6LfUpsR_d-V925NyVXQo-VMO5KOfzXaHJeLxAnNEAMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Installed documentation

2018-02-19 Thread Brian Coca
Manpage, ansible-doc --help  and online docs
(http://docs.ansible.com/ansible/latest/ansible-doc.html) show these
options, it was also added to the changelog.

Unsure of where else we need to put this info, open to suggestions.


-- 
--
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/CACVha7dh-U7iz8MbqDbpgA_XV8o4WtYmtgojNkMTnMzAZ3%2BZjA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Looking for Ansible AWX usability interview participants

2018-02-19 Thread jmitchel
I’ve been working with a grad student team to get them set up running AWX, 
and they have been excited and eager about this usability project they are 
working on!  The AWX engineering team will be reviewing the results of 
these interviews (in an anonymized fashion) to help us plan future 
enhancements and features--info from the student team below:

Hi!

We are a team of graduate students with the University of Michigan School 
of Information, and we are conducting user research for Red Hat’s 
AWX/Ansible project.

As part of this research, we would like to conduct some interviews, and our 
friends at Red Hat have suggested that we reach out to you all and see who 
might be interested. We are hoping to have an approximately hour-long 
conversation about your use of AWX/Ansible, and how you feel about the 
product. While we do need to meet over phone or video messenger, your 
identity will be completely protected in our final report, regardless of 
whatever comments you have. It doesn’t matter what your experience or 
comfort level with AWX is, input from anyone and everyone is useful, and 
the time you spend with us will directly help us help the AWX team improve 
their product!

We are hoping to get these interviews set up between now and February 23, 
so please let us know if you are interested and available at 
si622...@umich.edu, and give us a timeframe when you will be available to 
chat with us.

Thank you for your help!

Team 8

-- 
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/772fa993-fb4f-49cb-a82a-38ad452b4c29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Extracting an IP address from a shell command's return using a regex

2018-02-19 Thread Brian Coca
You need to use select to go over the list and get you the 'correct
line' as it is a 'list of lines', then you can extract the info from
that line.

Or just use stdout instead of stdout_lines.





-- 
--
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/CACVha7eQHn9wi3ifzXg65AppWrRdcBmUSfhXsffr%3DN12xP6Lfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Can Ansible consider switching from Google Groups to a Discourse instance?

2018-02-19 Thread Kai Stian Olstad
On Sunday, 18 February 2018 21.34.38 CET David Reagan wrote:
> I did a search, and I think the last time switching from mailing lists to a 
> forum was discussed was in 2014 here: 
> https://groups.google.com/d/topic/ansible-project/3NkSXNxULFw/discussion
> 
> Can Ansible consider switching from Google Groups to a Discourse instance?

I for one hope that will never happen.


> Elastic.co did so. It seemed like a successful move for them. Mozilla has 
> one. 
> 
> So far, my experience using Discourse has always been far superior to 
> Google Groups or other mailing lists. 

My experience is the opposite, nothing beats mailing list.


> Some of the things I thing would benefit us all:
> 
> * Markdown formatting

I don't see that, plain text with monospace font is better.


> What does everyone else think?
> 
> What are the pro's for Google Groups?

I find forum hard to use, all people top post so you don't know what they are 
replaying to (I know, a lot of people do that here also).
Threading doesn't work properly, technical and because people don't replay to a 
post, but to the thread.
On a forum you need to create yet another account.


-- 
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/5138993.f5BseTGcAl%40x1.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Dynamic Inventory Using CSV of Excel File ...

2018-02-19 Thread Kai Stian Olstad
On Friday, 16 February 2018 15.17.28 CET Hemant Kulkarni wrote:
> Hello All,
> 
> is there any way so that I can use CSV or excel file as Dynamic Inventory 
> in Ansiable ...  if yes can you please let me know how I do that ...

There are many different scripts here
https://github.com/ansible/ansible/tree/devel/contrib/inventory

but I don't think it's one for csv so you would need to write one.


-- 
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/1800494.kkvpr9QAol%40x1.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] [Ansible 2.4] include_tasks and import_tasks picking the first specified file in a ternary condition

2018-02-19 Thread Matt Martz
When supplying extra vars on the command line using key=value syntax, the
value will always be a string.  In python (and jinja2) any string with
non-zero length is always truthy.  So the strings "true" and "false" are
both truthy.

You have a few options:

Use JSON:

-e '{"condition": true}'

Use the |bool filter:

"{{ condition | bool | ternary ('docker1.yaml', 'docker2.yaml') }}"

I'd recommend including the |bool filter regardless, as that is going to
ensure things are processed as you expect.

On Mon, Feb 19, 2018 at 9:52 AM, ishan jain  wrote:

> Hi,
>
> I was trying out a few sample playbooks to understand the difference
> between static n dynamic imports, and i am stuck at a point where i am not
> sure what am i doing wrong.
>
>
> *hosts.info *
> [docker]
> docker1 ansible_host=0.0.0.0
>
>
> *include_with_vars.yaml*
> ---
> - hosts: docker
>   tasks:
> - include_tasks: "{{ condition | ternary ('docker1.yaml',
> 'docker2.yaml') }}"
>
> *import_with_vars.yaml*
> ---
> - hosts: docker
>   tasks:
> - import_tasks: "{{ condition | ternary ('docker1.yaml',
> 'docker2.yaml') }}"
>
>
> (docker1.yaml prints "msg": "Tasks 1 Host 1" and docker2.yaml prints
> "msg": "Tasks 2 Host 2")
>
>
> No matter how i execute this, it always includes/import docker1.yaml
>
> [root@8a98ab1d7dea include]# ansible --version
> ansible 2.4.3.0
>   config file = /etc/ansible/ansible.cfg
>   configured module search path = [u'/root/.ansible/plugins/modules',
> u'/usr/share/ansible/plugins/modules']
>   ansible python module location = /usr/lib/python2.7/site-
> packages/ansible-2.4.3.0-py2.7.egg/ansible
>   executable location = /usr/bin/ansible
>   python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5
> 20150623 (Red Hat 4.8.5-16)]
> [root@8a98ab1d7dea include]# ansible-playbook -i hosts.info
> include_with_vars.yaml -e condition=false
>
> PLAY [docker] 
> 
> ***
>
> TASK [Gathering Facts] **
> 
> 
> 
> ok: [docker1]
>
> TASK [include_tasks] **
> 
> 
> **
> included: /opt/include/docker1.yaml for docker1
>
> TASK [debug] 
> 
> 
> ok: [docker1] => {
> "msg": "Tasks 1 Host 1"
> }
>
> PLAY RECAP 
> 
> **
> docker1: ok=3changed=0unreachable=0failed=0
>
> [root@8a98ab1d7dea include]# ansible-playbook -i hosts.info
> include_with_vars.yaml -e condition=true
>
> PLAY [docker] 
> 
> ***
>
> TASK [Gathering Facts] **
> 
> 
> 
> ok: [docker1]
>
> TASK [include_tasks] **
> 
> 
> **
> included: /opt/include/docker1.yaml for docker1
>
> TASK [debug] 
> 
> 
> ok: [docker1] => {
> "msg": "Tasks 1 Host 1"
> }
>
> PLAY RECAP 
> 
> **
> docker1: ok=3changed=0unreachable=0failed=0
>
> [root@8a98ab1d7dea include]# ansible-playbook -i hosts.info
> import_with_vars.yaml -e condition=false
>
> PLAY [docker] 
> 
> ***
>
> TASK [Gathering Facts] **
> 
> 

Re: [ansible-project] [Ansible 2.4] include_tasks and import_tasks picking the first specified file in a ternary condition

2018-02-19 Thread Kai Stian Olstad
On Monday, 19 February 2018 16.52.02 CET ishan jain wrote:
> *include_with_vars.yaml*
> ---
> - hosts: docker
>   tasks:
> - include_tasks: "{{ condition | ternary ('docker1.yaml', 
> 'docker2.yaml') }}"
> 
> *import_with_vars.yaml*
> ---
> - hosts: docker
>   tasks:
> - import_tasks: "{{ condition | ternary ('docker1.yaml', 
> 'docker2.yaml') }}"
> 
> 
> (docker1.yaml prints "msg": "Tasks 1 Host 1" and docker2.yaml prints "msg": 
> "Tasks 2 Host 2")
> 
> 
> No matter how i execute this, it always includes/import docker1.yaml
> 


> [root@8a98ab1d7dea include]# ansible-playbook -i hosts.info 
> include_with_vars.yaml -e condition=false

Here condition is a string and not a bool so you need

{{ condition | bool | ternary ..


-- 
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/6416563.vzd7gj905g%40x1.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Issue with replace module not working with first block insert

2018-02-19 Thread Dave
My Ansible playbook has an issue where the replace module is not working 
with my first 'blockinfile' insert. It works fine with all the subsequent 
inserts. Is this a known issue?

-- 
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/1ef79ffc-a336-49f3-937f-8fac4ce4afa1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] How to save whole ansible_facts to file

2018-02-19 Thread Brian Coca
Use the jsonfile ansible cache, it will automatically store facts (and
only facts) into files.

In 2.5 we do have facts under ansible_facts and we hope to ONLY have
them there in the future, currently it is a toggle to allow them in
'main vars' or not.



-- 
--
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/CACVha7c0r2%2BeTgo8q5pAPkNACsmSPAFiv7aADpHZsCDf_gKBCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] [Ansible 2.4] include_tasks and import_tasks picking the first specified file in a ternary condition

2018-02-19 Thread ishan jain
Hi,

I was trying out a few sample playbooks to understand the difference 
between static n dynamic imports, and i am stuck at a point where i am not 
sure what am i doing wrong. 


*hosts.info*
[docker]
docker1 ansible_host=0.0.0.0


*include_with_vars.yaml*
---
- hosts: docker
  tasks:
- include_tasks: "{{ condition | ternary ('docker1.yaml', 
'docker2.yaml') }}"

*import_with_vars.yaml*
---
- hosts: docker
  tasks:
- import_tasks: "{{ condition | ternary ('docker1.yaml', 
'docker2.yaml') }}"


(docker1.yaml prints "msg": "Tasks 1 Host 1" and docker2.yaml prints "msg": 
"Tasks 2 Host 2")


No matter how i execute this, it always includes/import docker1.yaml

[root@8a98ab1d7dea include]# ansible --version
ansible 2.4.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', 
u'/usr/share/ansible/plugins/modules']
  ansible python module location = 
/usr/lib/python2.7/site-packages/ansible-2.4.3.0-py2.7.egg/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 
20150623 (Red Hat 4.8.5-16)]
[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info 
include_with_vars.yaml -e condition=false

PLAY [docker] 
***

TASK [Gathering Facts] 
**
ok: [docker1]

TASK [include_tasks] 

included: /opt/include/docker1.yaml for docker1

TASK [debug] 

ok: [docker1] => {
"msg": "Tasks 1 Host 1"
}

PLAY RECAP 
**
docker1: ok=3changed=0unreachable=0failed=0

[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info 
include_with_vars.yaml -e condition=true

PLAY [docker] 
***

TASK [Gathering Facts] 
**
ok: [docker1]

TASK [include_tasks] 

included: /opt/include/docker1.yaml for docker1

TASK [debug] 

ok: [docker1] => {
"msg": "Tasks 1 Host 1"
}

PLAY RECAP 
**
docker1: ok=3changed=0unreachable=0failed=0

[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info 
import_with_vars.yaml -e condition=false

PLAY [docker] 
***

TASK [Gathering Facts] 
**
ok: [docker1]

TASK [debug] 

ok: [docker1] => {
"msg": "Tasks 1 Host 1"
}

PLAY RECAP 
**
docker1: ok=2changed=0unreachable=0failed=0

[root@8a98ab1d7dea include]# ansible-playbook -i hosts.info 
import_with_vars.yaml -e condition=true

PLAY [docker] 

[ansible-project] Re: Dynamic Inventory using Active Directory / LDAP

2018-02-19 Thread 'J Hawkesworth' via Ansible Project
Here's a rather basic and unfinished script which might be of use to you 
too.

By the way inventory plugins are a thing now, might be worth while making 
into a inventory plugin rather than a simple inventory script



#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''


Example dynamic inventory script which queries active directory.


Likely to need modification for each environment as there are likely
to be different versions of active directory in use needing different
connection parameters.


To use, create a configuration file in users's home dir
called .ansible_inventory.cfg


must contain a [domain] section
and then settings for the following values
domain_controller
connect_to_dc_with_ssl (either True or False)
query_domain
query_user
query_pass


'''


# import class and constants
from ldap3 import Server, Connection, ALL, NTLM, Tls
import json
import ssl
import pprint
import re
import ConfigParser, os


config = ConfigParser.ConfigParser()
user_dir = os.path.expanduser("~")
config.read(user_dir + '/.ansible_inventory.cfg')


domain_controller = config.get('domain', 'domain_controller')
connect_to_dc_with_ssl= config.getboolean('domain', 'connect_to_dc_with_ssl
')
query_domain =  config.get('domain', 'query_domain')
query_user =  config.get('domain', 'query_user')
query_cred = config.get('domain', 'query_pass')


user = query_domain + "\\" + query_user


# define the server and the connection


# TODO see if not doing get_info speeds things up
server = Server(domain_controller, use_ssl=connect_to_dc_with_ssl, 
get_info='ALL')


# TODO remove debug statements
# print "showing server information"
# print (server.info)




# TODO determine if it is quicker to use auto_bind=True
#conn = Connection(server, user="playnetwork.com\\ldapusr", 
password=ldappwd, authentication=NTLM, auto_bind=True)


conn = Connection(server, user=user, password=query_cred, 
authentication=NTLM)


conn.open()
conn.bind()


# conn.entries
# print(conn)
conn.search('CN=Computers, DC=subdomain, DC=yourorg, DC=yourcompany, DC=com', 
'(objectclass=computer)', attributes=["name","OperatingSystem"])


#pp = pprint.PrettyPrinter(indent=4)
#pp.pprint (conn.response)


# print conn.entries


# generate list of all servers (replace 'HOST' with something that matches 
machines you want to be part of inventory
names = []
for x in conn.response:
atts = x['attributes']
if 'operatingSystem' in atts:
 if atts["operatingSystem"] == 'Windows Server 2012 R2 Standard':
 if re.match('HOST', atts['name'] ):
names.append(atts['name'])


# TODO add group.  This ought to be doable via a server naming convention


# TODO add _meta for speed as mentioned here: 
http://docs.ansible.com/ansible/developing_inventory.html


# TODO add vars


conn.unbind()


hosts = {}
hosts['hosts'] = names
var = {'a':True}


export = {}
export['main_group'] = hosts
export['main_group_win'] = hosts
#export['vars'] = var



On Wednesday, February 14, 2018 at 8:02:33 AM UTC, balz.as...@unibas.ch 
wrote:
>
> We do exactly that: We run ansible in pull mode with AD as inventory.
>
> Maybe you can take a look at the dynamic inventory script we use: 
> https://github.com/ANTS-Framework/ants/blob/master/antslib/inventory/inventory_ad
> (Because it is used for ansible-pull, it will only return the current 
> host, but it should give you some ideas.) 
>
> Am Dienstag, 13. Februar 2018 02:50:31 UTC+1 schrieb Aaron K:
>>
>> Does anyone have code that can pull a dynamic inventory from list of AD 
>> OUs?  Want to use the windows_update module to patch our servers only in 
>> specific OUs.
>>
>> Maybe I missed it, but I don't see Windows Active Directory inventory 
>> here:  https://github.com/ansible/ansible/tree/devel/contrib/inventory
>>
>

-- 
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/73217875-2dfd-406a-9da4-1cadb1672a62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows - become_method runas - password definition

2018-02-19 Thread Jeremie Levy
Hi
No $ but @ is there.
I created a service with the credentials so they are working. (win_service)
It's just for this. And win_file or win_stat, it doesn't matter, I can't 
find out how to pass the password.



On Monday, February 19, 2018 at 3:47:53 PM UTC+2, J Hawkesworth wrote:
>
> Hello,
>
> I haven't tried this myself but I am wondering if you maybe have a 
> password containing a special character, such as $ - I have had trouble 
> with passwords which contain characters which have reserved meaning in 
> powershell in the past?
>
> Also do you perhaps mean to use win_file module instead of win_stat? If I 
> recall, win_stat only returns information on a file, such as whether it 
> exists and is in the expected state, but win_file will ensure a file or 
> directory exists
>
> win_file: 
>state: directory
>path: c:\Users\bld_usr
>
> Hope this helps,
>
> Jon
>
>
>
> On Monday, February 19, 2018 at 9:40:07 AM UTC, Jeremie Levy wrote:
>>
>> Hello
>> I am using successfully ansible in my windows environment with Kerberos.
>> I am still having trouble if i want to execute a task as another user 
>> than my ansible user.
>>
>> For example, i want to execute specific task as build user to make sure 
>> it's home dir is present - if not i guess my command will create it by 
>> login this specific user.
>>
>>
>> build_usr_password is in the var files (i used the debug module to check 
>> i can access it)
>>
>> - name: Touching a file in order to make sure the account home dir is 
>> created.
>> win_stat:
>> path: C:\Users\build_usr
>> state: present
>> become: yes
>> become_method: runas
>> become_user: build_usr@DOMAIN
>> password: "{{ build_usr_password }}"
>>
>>
>> I tried *ansible_become_password* *become_password* and 
>> *ansible_password*. Still same issue:
>>
>> The full traceback is:
>> LogonUser failed (The user name or password is incorrect, Win32ErrorCode 
>> 1326)
>> At line:623 char:13
>> + throw [Ansible.Shell.Win32Exception] "LogonUser failed"
>> + ~~~
>> + CategoryInfo  : OperationStopped: (:) [], Win32Exception
>> + FullyQualifiedErrorId : LogonUser failed (The user name or password 
>> is incorrect, Win32ErrorCode 1326)
>>
>>
>> failed: [hasgqba110.ger.corp.intel.com] (item=bEeq07WG8-RQ.Myr9Ymd) => {
>> "changed": false,
>> "item": "bEeq07WG8-RQ.Myr9Ymd",
>> "msg": "LogonUser failed (The user name or password is incorrect, 
>> Win32ErrorCode 1326)"
>> }
>>
>> How do i define the password for this task ? (the password is in the 
>> vault encrypted file, i don't want to/can't pass it via the CLI)
>>
>> ansible-playbook 2.4.3.0  
>>  
>> python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 
>> 20160609]  
>>
>>
>> Jordan ? :)
>>
>>

-- 
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/e22fe248-571e-4f00-8d60-9a17ef0094bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: KDC has no support for encryption type

2018-02-19 Thread 'J Hawkesworth' via Ansible Project
I believe you can get round this by setting the following in your 
[ibdefaults] section of your krb5.conf

  default_tgs_enctypes = arcfour-hmac-md5 des-cbc-crc des-cbc-md5
  default_tkt_enctypes = arcfour-hmac-md5 des-cbc-crc des-cbc-md5

Hope this helps,

Jon


On Monday, February 19, 2018 at 11:17:41 AM UTC, MKPhil wrote:
>
> When connecting from Ansible 2.3.0.0 to Windows 2008 (not R2) running 
> PowerShell 3.0 I'm getting:
>
> hostname.domain.corp | UNREACHABLE! => {
> "changed": false,
> "msg": "kerberos: (('Unspecified GSS failure.  Minor code may provide 
> more information', 851968), ('KDC has no support for encryption type', 
> -1765328370)), ssl: 401 Unauthorized. basic auth failed",
> "unreachable": true
> }
>
>
> The same playbook and account work on Windows 2012 servers on the same 
> domain.
>
> Any thoughts?
>

-- 
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/16e3a4eb-39be-447c-b011-9a99357edc5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Windows - become_method runas - password definition

2018-02-19 Thread 'J Hawkesworth' via Ansible Project
Hello,

I haven't tried this myself but I am wondering if you maybe have a password 
containing a special character, such as $ - I have had trouble with 
passwords which contain characters which have reserved meaning in 
powershell in the past?

Also do you perhaps mean to use win_file module instead of win_stat? If I 
recall, win_stat only returns information on a file, such as whether it 
exists and is in the expected state, but win_file will ensure a file or 
directory exists

win_file: 
   state: directory
   path: c:\Users\bld_usr

Hope this helps,

Jon



On Monday, February 19, 2018 at 9:40:07 AM UTC, Jeremie Levy wrote:
>
> Hello
> I am using successfully ansible in my windows environment with Kerberos.
> I am still having trouble if i want to execute a task as another user than 
> my ansible user.
>
> For example, i want to execute specific task as build user to make sure 
> it's home dir is present - if not i guess my command will create it by 
> login this specific user.
>
>
> build_usr_password is in the var files (i used the debug module to check i 
> can access it)
>
> - name: Touching a file in order to make sure the account home dir is 
> created.
> win_stat:
> path: C:\Users\build_usr
> state: present
> become: yes
> become_method: runas
> become_user: build_usr@DOMAIN
> password: "{{ build_usr_password }}"
>
>
> I tried *ansible_become_password* *become_password* and *ansible_password*. 
> Still same issue:
>
> The full traceback is:
> LogonUser failed (The user name or password is incorrect, Win32ErrorCode 
> 1326)
> At line:623 char:13
> + throw [Ansible.Shell.Win32Exception] "LogonUser failed"
> + ~~~
> + CategoryInfo  : OperationStopped: (:) [], Win32Exception
> + FullyQualifiedErrorId : LogonUser failed (The user name or password 
> is incorrect, Win32ErrorCode 1326)
>
>
> failed: [hasgqba110.ger.corp.intel.com] (item=bEeq07WG8-RQ.Myr9Ymd) => {
> "changed": false,
> "item": "bEeq07WG8-RQ.Myr9Ymd",
> "msg": "LogonUser failed (The user name or password is incorrect, 
> Win32ErrorCode 1326)"
> }
>
> How do i define the password for this task ? (the password is in the vault 
> encrypted file, i don't want to/can't pass it via the CLI)
>
> ansible-playbook 2.4.3.0  
>  
> python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 
> 20160609]  
>
>
> Jordan ? :)
>
>

-- 
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/315eabb9-0a1e-4b8a-949a-b6c6588c4197%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] XML module xpath issues - "does not reference a node" error

2018-02-19 Thread Kai Stian Olstad

On 19.02.2018 13:57, ADB101 wrote:
I can get some xpath's to work correctly, but only in "simple" (?) 
forms.

For example:

- name: Check current value
  xml:
file: "{{oam_xml_file}}"
xpath:
/x:Configuration/Setting[@Name='NGAMConfiguration']/Setting[@Name='DeployedComponent']/Setting[@Name='Agent']/Setting[@Name='WebGate']/Setting[@Name='Instance']/Setting[@Name='APPS_OAM11G']/Setting[@Name='UserDefinedParameters']/Setting[@Name='client_request_retry_attempts']/*
content: text
namespaces:
   x: http://www.w3.org/2001/XMLSchema

The issue is that I really need the full xpath to work as there are 
often
several entries with the same "Name='*tag*'" that are only 
distinguishable

by their full path. I have tried even going one level down in the xml,
using a full path, and I still get "does not reference a node" error
message.


I'm not sure, but my hunch is that you need to postfix all with the 
namespace, so /x:Settings on all of them.


--
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/ba68dd1d34c565cba4139644f2b87f1c%40olstad.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] SSL issue with get_url module

2018-02-19 Thread Mehul Ved
I am trying to download a file from the repo to a server using
ansible. This has been working fine on all the old machines but on a
new machine, which has the same setup, it keeps giving me SSL error.
My environment is as below:

Jenkins machine(that triggers the ansible job)

$ ansible all -i inventory/localhost -c local -m setup -a
'filter=ansible_python'localhost | SUCCESS => {
"ansible_facts": {
"ansible_python": {
"executable": "/usr/bin/python",
"has_sslcontext": true,
"type": "CPython",
"version": {
"major": 2,
"micro": 9,
"minor": 7,
"releaselevel": "final",
"serial": 0
},
"version_info": [
2,
7,
9,
"final",
0
]
}
},
"changed": false
}

$ ansible all -i inventory/localhost -c local -m uri -a
url=https://devops.rightleads.io/
localhost | SUCCESS => {
"accept_ranges": "bytes",
"changed": false,
"connection": "close",
"content_length": "10701",
"content_type": "text/html",
"date": "Mon, 19 Feb 2018 11:33:15 GMT",
"etag": "\"29cd-54815428d497e\"",
"last_modified": "Thu, 09 Feb 2017 09:03:51 GMT",
"msg": "OK (10701 bytes)",
"redirected": false,
"server": "Apache/2.4.10 (Debian)",
"status": 200,
"url": "https://devops.rightleads.io/;,
"vary": "Accept-Encoding"
}



Dev machine

$ ansible tag_web -i inventory/gce.py -u admin
--private-key=projectkey -m setup -a 'filter=ansible_python' --limit
tag_dev
dev-web | SUCCESS => {
"ansible_facts": {
"ansible_python": {
"executable": "/usr/bin/python",
"has_sslcontext": true,
"type": "CPython",
"version": {
"major": 2,
"micro": 13,
"minor": 7,
"releaselevel": "final",
"serial": 0
},
"version_info": [
2,
7,
13,
"final",
0
]
}
},
"changed": false
}

$ ansible tag_web -i inventory/gce.py -u admin
--private-key=projectkey -m uri -a url=https://devops.rightleads.io/
--limit tag_dev
dev-web | SUCCESS => {
"accept_ranges": "bytes",
"changed": false,
"connection": "close",
"content_length": "10701",
"content_type": "text/html",
"date": "Mon, 19 Feb 2018 11:35:00 GMT",
"etag": "\"29cd-54815428d497e\"",
"last_modified": "Thu, 09 Feb 2017 09:03:51 GMT",
"msg": "OK (10701 bytes)",
"redirected": false,
"server": "Apache/2.4.10 (Debian)",
"status": 200,
"url": "https://devops.rightleads.io/;,
"vary": "Accept-Encoding"
}

$ ansible tag_web -i inventory/gce.py --user admin
--private-key=projectkey --limit=tag_dev --sudo -m get_url -a
"url=https://devops.rightleads.io/repo/webapi/webapi_demo_4.tar
dest=/tmp/webapi.tar force=yes" -vvv

dev-web | SUCCESS => {
"changed": true,
"checksum_dest": null,
"checksum_src": "d14de4a99dd20c5128fd78ddbf6c70801057d4a3",
"dest": "/tmp/webapi.tar",
"gid": 0,
"group": "root",
"invocation": {
"module_args": {
"backup": false,
"checksum": "",
"content": null,
"delimiter": null,
"dest": "/tmp/webapi.tar",
"directory_mode": null,
"follow": false,
"force": true,
"force_basic_auth": false,
"group": null,
"headers": null,
"http_agent": "ansible-httpget",
"mode": null,
"owner": null,
"path": "/tmp/webapi.tar",
"regexp": null,
"remote_src": null,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"sha256sum": "",
"src": null,
"timeout": 10,
"tmp_dest": "",
"unsafe_writes": null,
"url": "https://devops.rightleads.io/repo/webapi/webapi_demo_4.tar;,
"url_password": "xxx",
"url_username": "yyy",
"use_proxy": true,
"validate_certs": true
},
"module_name": "get_url"
},
"md5sum": "96166c42eb5a47766dc5e02a2590829f",
"mode": "0644",
"msg": "OK (136683520 bytes)",
"owner": "root",
"size": 136683520,
"src": "/tmp/tmpJgzn5R",
"state": "file",
"uid": 0,
"url": "https://devops.rightleads.io/repo/webapi/webapi_demo_4.tar;
}

$ python -V
Python 2.7.13

$ ls -l /etc/ssl/certs/DST_Root_CA_X3.pem
lrwxrwxrwx 1 root root 53 Dec 14 00:19
/etc/ssl/certs/DST_Root_CA_X3.pem ->
/usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt

$ echo quit | openssl s_client -connect devops.rightleads.io:443 | head
 depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
 

[ansible-project] XML module xpath issues - "does not reference a node" error

2018-02-19 Thread ADB101
Hi All.

I am having issues getting the "xml" module to accept what I believe to be 
valid xpaths, it just returns "does not reference a node". I have used an 
online xpath checker (https://www.freeformatter.com/xpath-tester.html) 
which, when I use the target xml file, gives me the correct data. The xml 
file is from an Oracle middleware product so I can't template it and I have 
to make the config changes directly in the xml file.

I can get some xpath's to work correctly, but only in "simple" (?) forms. 
For example:

- name: Check current value
  xml:
file: "{{oam_xml_file}}"
xpath: 
/x:Configuration/Setting[@Name='NGAMConfiguration']/Setting[@Name='DeployedComponent']/Setting[@Name='Agent']/Setting[@Name='WebGate']/Setting[@Name='Instance']/Setting[@Name='APPS_OAM11G']/Setting[@Name='UserDefinedParameters']/Setting[@Name='client_request_retry_attempts']/*
content: text
namespaces:
   x: http://www.w3.org/2001/XMLSchema

fails with "does not reference a node" (but works fine when checked using 
the online xpath checker) but:

- name: Check current value
  xml:
file: "{{oam_xml_file}}"
xpath: //x:Setting[@Name='client_request_retry_attempts']/*
content: text
namespaces:
   x: http://www.w3.org/2001/XMLSchema

returns the value I am expecting. (Note: I could only get the short version 
working by adding the "namespaces" option).

The issue is that I really need the full xpath to work as there are often 
several entries with the same "Name='*tag*'" that are only distinguishable 
by their full path. I have tried even going one level down in the xml, 
using a full path, and I still get "does not reference a node" error 
message.

The original xml is a bit of a beast so I have put a copy here 
rather 
than paste it in.

I'm running Ansible 2.2.1 so I'm using a version of the "xml" module before 
it was bundled with Ansible 2.4. For various reasons I have to stick with 
using version 2.2.1 for the time being so I was hoping someone could either 
inform me how to make full path xpaths work (or tell me that I'm out of 
luck and have to wait until we can upgrade to Ansible 2.4!)

Many thanks,
Aidan

-- 
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/dbe6e627-390e-483f-8ec5-21263e35d963%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Extracting an IP address from a shell command's return using a regex

2018-02-19 Thread J-P Methot
Hi,

I've been stuck on this issue for a few days and I'm still unable to make 
it work, even though it should be doable. Essentially, I'm doing a shell 
command which gives me the following return (please don't suggest to use an 
ansible module for this, the ansible module and shade don't support 
choosing the subnet when associating a floatingip)


   1. "stdout_lines": [
   2. "Created a new floatingip:", 
   3. 
   "+-+--+", 
   4. "| Field   | Value   
|", 
   5. 
   "+-+--+", 
   6. "| created_at  | 2018-02-19T09:32:44Z 
   |", 
   7. "| description | 
|", 
   8. "| fixed_ip_address| 10.80.16.60 
|", 
   9. "| floating_ip_address | 192.168.0.1 
  |", 
   10. "| floating_network_id | uuid |", 
   11. "| id  | uuid |", 
   12. "| port_id | uuid |", 
   13. "| project_id  | uuid |", 
   14. "| revision_number | 1   
|", 
   15. "| router_id   | uuid |", 
   16. "| status  | DOWN   
 |", 
   17. "| tenant_id   | uuid |", 
   18. "| updated_at  | 2018-02-19T09:32:44Z   
 |", 
   19. 
   "+-+--+
   

Essentially, I want to extract the floating_ip_address line. So, I've been 
using a commonly recognized regex for IP address and, right now, I've 
reached the point where I have the following line:


   1. - name: extract the ip line
   2.   set_fact:
   3. regexcomp: "{{ rawfloating.stdout_lines | 
   regex_search('floating_ip_address \\| 
   \\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b') }}"
   
Now ansible tells me that it's expecting a string or buffer. I'm not sure 
what to do anymore. Anyone has any ideas?

-- 
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/643e34e6-416f-44b2-8e96-a72ef14b2e25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Windows - become_method runas - password definition

2018-02-19 Thread Jeremie Levy
Hello
I am using successfully ansible in my windows environment with Kerberos.
I am still having trouble if i want to execute a task as another user than 
my ansible user.

For example, i want to execute specific task as build user to make sure 
it's home dir is present - if not i guess my command will create it by 
login this specific user.


build_usr_password is in the var files (i used the debug module to check i 
can access it)

- name: Touching a file in order to make sure the account home dir is 
created.
win_stat:
path: C:\Users\build_usr
state: present
become: yes
become_method: runas
become_user: build_usr@DOMAIN
password: "{{ build_usr_password }}"


I tried *ansible_become_password* *become_password* and *ansible_password*. 
Still same issue:

The full traceback is:
LogonUser failed (The user name or password is incorrect, Win32ErrorCode 
1326)
At line:623 char:13
+ throw [Ansible.Shell.Win32Exception] "LogonUser failed"
+ ~~~
+ CategoryInfo  : OperationStopped: (:) [], Win32Exception
+ FullyQualifiedErrorId : LogonUser failed (The user name or password 
is incorrect, Win32ErrorCode 1326)


failed: [hasgqba110.ger.corp.intel.com] (item=bEeq07WG8-RQ.Myr9Ymd) => {
"changed": false,
"item": "bEeq07WG8-RQ.Myr9Ymd",
"msg": "LogonUser failed (The user name or password is incorrect, 
Win32ErrorCode 1326)"
}

How do i define the password for this task ? (the password is in the vault 
encrypted file, i don't want to/can't pass it via the CLI)

ansible-playbook 2.4.3.0
   
python version = 2.7.12 (default, Dec  4 2017, 14:50:18) [GCC 5.4.0 
20160609]  


Jordan ? :)

-- 
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/34aaac74-f6dc-4e84-b628-65671e3e0b0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.