[ansible-project] Re: ios_modules

2017-12-12 Thread SK
Have you been able to identify anything around this?  I am trying to get 
Ansible to work on SG200 series switch and unable to.  Is it supported?

Thank you in advance!

On Monday, April 3, 2017 at 10:27:21 PM UTC+8, Dave wrote:
>
> Hi All,
>
> I've got a question regarding the supported platforms I hope someone can 
> answer that. Does ansible support SG200 and SG300 switches? They do not 
> really use the classic Cisco IOS hence I am not sure about it. Thanks in 
> advance.
>
> Regards,
> Dave
>
>

-- 
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/1e4d7542-58f3-4583-a5a1-45f969cf98e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Get all groups from parent group

2017-12-12 Thread starflighter . one
Hi guys,

I want to get all existent subgroups from a parent group.

Example Playbook:

---
- hosts: "test"

  tasks:
  - group_by:
 key: "{{ansible_distribution}}-{{ansible_distribution_major_version}}"
 parents: "dist"

  - debug: var="{{ groups['dist'] }}"
run_once: true

#unfortunately I only get all the hosts of the parent group instead the 
groups created by 'group_by'

#Something like {% for group in groups['dist'] %}  {% endfor %} ??
#or this:
  - name: test
command: echo {{ item }}
with_items: "{{ groups['dist'] }}"
delegate_to: localhost
run_once: true

#-> only hosts... :-(


Any ideas?

Thanks,
starflighter

Ansible-Version: 

ansible 2.4.1.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/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 
20160609]


-- 
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/c1357a91-64c7-4ffb-a1b1-92d04d464a36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Jinja2 Templating Example

2017-12-12 Thread starflighter . one
Hi,

here are the official examples:

https://github.com/ansible/ansible-examples/tree/master/language_features

There are also templates.

-- 
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/c711474d-2bf7-4d4d-87b1-375d227609ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible power shell script failing on Ansible but completing on target machine

2017-12-12 Thread Josh Bergman
Hello,

I have just started to use Ansible to complete some automation aspects on 
the Windows platform.  My first task was to run our power shell script to 
install out Anti Virus software.

I was able to achieve this by creating a bat file that calls the power 
shell script with psexec.  The bat file runs with elevated privileges 
allowing the script to work.  The Ansible playbook completes with a psexec 
error and says the playbook fails.  But when I look at the machine this 
script completes successfully.  Below is the error I receive:


fatal:
[IP]: FAILED! => {"changed": true, "delta":
"0:00:00.749984", "end": "2017-12-11
07:32:08.172137", "failed": true, "psexec_command":
"c:\\PSTools\\psexec.exe -accepteula psexec -u administrator -p force -s
-d cmd.exe /c \"C:\\ansible\\av\\av-use.bat\"", "rc":
1412, "start": "2017-12-11 07:32:07.422153",
"stderr": "psexec exited with error code 1412.\r\n",
"stderr_lines": ["psexec exited with error code 1412."],
"stdout": "\r\nPsExec v2.2 - Execute processes
remotely\r\nCopyright (C) 2001-2016 Mark Russinovich\r\nSysinternals -
www.sysinternals.com\r\n\r\n", "stdout_lines": ["",
"PsExec v2.2 - Execute processes remotely", "Copyright (C)
2001-2016 Mark Russinovich", "Sysinternals - www.sysinternals.com",
""]}

 
I have also received the same sort of error with the Amazon SSM script as 
well.  This script completes too.

Does anyone have any insight on this false negative?  I am trying to chain 
several things together in my playbook, but once this script fails, the 
playbook stops.  


Thank you in advance!

Josh

-- 
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/fc275bc7-4605-4509-89b3-ae0716716b17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] archive module does not add all the matched files to destination archive file

2017-12-12 Thread Lokesh
I want to search for files modified last 1day and add them to archive. I 
dont see all the matched files added to the destination zip file but see 
only the last file in the zip

ansible --version
ansible 2.3.1.0
  config file = /Volumes/Projects/dat/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.10 (default, Feb  7 2017, 00:08:15) [GCC 4.2.1 
Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

...

- name: find files
  find:
paths: /var/log/hadoop-hdfs
age: -1d
age_stamp: mtime
file_type: file
  register: files_matched


- name: archive found files
  archive:
path: "{{ item.path }}"
dest: /tmp/hadoop2.zip
format: zip
  with_items: "{{ files_matched.files }}"

-- 
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/5f36bc1d-4718-4df2-9423-29ba7834e02f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] End ansible

2017-12-12 Thread Kai Stian Olstad
On Tuesday, 12 December 2017 07.05.17 CET venkatesh rasipuram wrote:
> I have my ansible play book. where I am running the yaml scripting 
> sequentially (which mean run one after another host serial -1)
> 
> As soon as I find the right host to set, I wanted to exit from the playbook 
> and do not want to continue for further host.
> 
> end_play will end the particular execution but it is moving to another 
> host. what is the command to exit completely from ansible scripting?

You have the module meta with end_play.

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


Re: [ansible-project] reading from files

2017-12-12 Thread coach rhca
i am trying to use the shell:  cat testfile |sed 's/\//\n/g' and got the
values in column wise ,could you please help as how i can get this values
individually using register.

On Tue, Dec 12, 2017 at 12:00 PM, coach rhca  wrote:

> just to add the flatfile is on a remote machine...
>
> On Tue, Dec 12, 2017 at 11:58 AM,  wrote:
>
>> Hi,
>>
>> Trying to read the values from flat files and to use it as a variables in
>> the ansible playbook , for example
>>
>> the flatfile is
>> #cat output
>>
>>  example.com/development/testcaseone:v99
>>
>> I want to use above values as a variables in the playbook , just like
>> ---
>> - hosts:
>>   vars:
>> rt1: example.com
>> stage_name: development
>> job_name: testcaseone
>> version_number: v99
>>
>>
>> I tried with lookup ('file', /path/to/output) but it gives the entire
>> output of the value..
>>
>> thanks for the help..
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Ansible Project" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/ansible-project/OipBBxJ_NNc/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/ms
>> gid/ansible-project/0dfc15cc-9ec2-4722-a04e-a4319cfcbc7a%
>> 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/CALguqPKgWDh7%2Bb%2Bf70y0SbheNOt9dTkz4nNNOZV5HB_y5yQd5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] reading from files

2017-12-12 Thread Kai Stian Olstad
On Tuesday, 12 December 2017 07.28.53 CET coach.r...@gmail.com wrote:
> Hi, 
> 
> Trying to read the values from flat files and to use it as a variables in 
> the ansible playbook , for example 
>  
> the flatfile is 
> #cat output
> 
>  example.com/development/testcaseone:v99 
> 
> I want to use above values as a variables in the playbook , just like 
> ---
> - hosts: 
>   vars:
> rt1: example.com
> stage_name: development
> job_name: testcaseone
> version_number: v99
> 
> 
> I tried with lookup ('file', /path/to/output) but it gives the entire 
> output of the value..

Not tested but something like this might work.

  - fetch:
  src: /path/to/file
register: r

  - set_fact:
  rt1: '{{ (r.content | b64decode).split('/')[0] }}'
  stage_name: '{{ (r.content | b64decode).split('/')[1] }}'
  job_name: '{{ (r.content | b64decode).split('/')[2].split(':')[0] }}'
  version_number: '{{ (r.content | b64decode).split('/')[2].split(':')[1] 
}}'
 

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


[ansible-project] Variable precedence and why to over rule ?

2017-12-12 Thread akazia . info
Hello,

there is a quite simple setup I am sure many of us came across this: 
1. you have lean, slim and dedicate Roles
2. every role has its own role vars
3. playbooks include the roles

Up to this point nothing spezial 

Now: lest assume you have an base path for an application, most likely you 
will need this path in many roles. 
To keep the roles independent you would define this base path in every role 
vars where needed
Hm, now you include some roles in a playbook and in case of a change on 
e.g. the base path you need to change that in every role

One help would be to use extra vars to overrule the role vars But what if 
there are many potential candidates for a change??


So I would like to be able to include vars in a playbook to overrule the 
variables in the roles. But this is not possible
a) include_vars is not allowed in playbooks
b) var_files (what would work in playbooks) will be over written by role 
vars


Good question: how do you do solve this situation??  May be I want 
something odd and there is a much simpler way?

Thanks for any hint
Michael

-- 
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/9cf95fc0-f73f-4aba-86cf-58ad62ab640d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Variable precedence and why to over rule ?

2017-12-12 Thread Kai Stian Olstad
On Tuesday, 12 December 2017 20.46.26 CET akazia.i...@gmail.com wrote:
> there is a quite simple setup I am sure many of us came across this: 
> 1. you have lean, slim and dedicate Roles
> 2. every role has its own role vars
> 3. playbooks include the roles
> 
> Up to this point nothing spezial 
> 
> Now: lest assume you have an base path for an application, most likely you 
> will need this path in many roles. 
> To keep the roles independent you would define this base path in every role 
> vars where needed
> Hm, now you include some roles in a playbook and in case of a change on 
> e.g. the base path you need to change that in every role
> 
> One help would be to use extra vars to overrule the role vars But what if 
> there are many potential candidates for a change??
> 
> 
> So I would like to be able to include vars in a playbook to overrule the 
> variables in the roles. But this is not possible
> a) include_vars is not allowed in playbooks
> b) var_files (what would work in playbooks) will be over written by role 
> vars
> 
> 
> Good question: how do you do solve this situation??  May be I want 
> something odd and there is a much simpler way?

Use defaults and not the vars folder in the role, then you can overwrite the 
variable anywhere you like.

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


Re: [ansible-project] Variable precedence and why to over rule ?

2017-12-12 Thread akazia . info
OMG! 
I complete over saw this. Thanks a lot!

Am Dienstag, 12. Dezember 2017 20:57:03 UTC+1 schrieb Kai Stian Olstad:
>
> On Tuesday, 12 December 2017 20.46.26 CET akazi...@gmail.com  
> wrote: 
> > there is a quite simple setup I am sure many of us came across this: 
> > 1. you have lean, slim and dedicate Roles 
> > 2. every role has its own role vars 
> > 3. playbooks include the roles 
> > 
> > Up to this point nothing spezial 
> > 
> > Now: lest assume you have an base path for an application, most likely 
> you 
> > will need this path in many roles. 
> > To keep the roles independent you would define this base path in every 
> role 
> > vars where needed 
> > Hm, now you include some roles in a playbook and in case of a change on 
> > e.g. the base path you need to change that in every role 
> > 
> > One help would be to use extra vars to overrule the role vars But what 
> if 
> > there are many potential candidates for a change?? 
> > 
> > 
> > So I would like to be able to include vars in a playbook to overrule the 
> > variables in the roles. But this is not possible 
> > a) include_vars is not allowed in playbooks 
> > b) var_files (what would work in playbooks) will be over written by role 
> > vars 
> > 
> > 
> > Good question: how do you do solve this situation??  May be I want 
> > something odd and there is a much simpler way? 
>
> Use defaults and not the vars folder in the role, then you can overwrite 
> the variable anywhere you like. 
>
> -- 
> 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/20855f90-8300-4cb7-a2e0-55fc9bbc45da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Starting nrpe client using ansible task

2017-12-12 Thread Varun Raj c v
I have written an ansible playbook to automate setup of nrpe 2.12 client 
which we use. The last step of the task is to start nrpe client as nagios 
user. 

### starting nrpe 
- name: go to INIT.D and start nrpe
become: yes
become_user: nagios
command: ./nrpe-server start
args:
chdir: /opt/app/nrpe-2.12/init.d
We have the ansible git repo being invoked from GOCD. In GOCD console, I am 
not finding any errors.

TASK [nrpe : go to INIT.D and start nrpe] 
**
changed: [96.118.233.22]

When i login to server, it shows nrpe is running, but I am unable to see 
the nrpe process. I am unable to figure out what mistake am committing 
here. Would appreciate any help with 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/2ac49cec-7179-43a7-8dd8-f1fc878a27a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] SSL/Certificate Errors when running playbooks against Azure

2017-12-12 Thread JOS
Hello,

So I have an Azure free trial subscription and am trying to deploy VMs for 
it through ansible.  For reference, I mostly followed this 
guide: https://github.com/erjosito/ansible-azure-lab

I am unable to execute any playbook task at all, even something as simple 
as merely creating a resource group with a network.  Here is the error I 
always get:

fatal: [192.168.0.177]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "From cffi callback :\nTraceback (most recent call last):\n  File 
\"/usr/lib/python2.7/site-packages/OpenSSL/SSL.py\", line 313, in 
wrapper\n_lib.X509_up_ref(x509)\nAttributeError: 'module' object has no 
attribute 'X509_up_ref'\nTraceback (most recent call last):\n  File 
\"/tmp/ansible_uaTUwO/ansible_module_azure_rm_virtualnetwork.py\", line 
354, in \nmain()\n  File 
\"/tmp/ansible_uaTUwO/ansible_module_azure_rm_virtualnetwork.py\", line 
351, in main\nAzureRMVirtualNetwork()\n  File 
\"/tmp/ansible_uaTUwO/ansible_module_azure_rm_virtualnetwork.py\", line 
206, in __init__\nsupports_check_mode=True)\n  File 
\"/tmp/ansible_uaTUwO/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\",
 
line 235, in __init__\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 440, in __init__\nself.set_token()\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 473, in set_token\nraise_with_traceback(AuthenticationError, \"\", 
err)\n  File \"/usr/lib/python2.7/site-packages/msrest/exceptions.py\", 
line 48, in raise_with_traceback\nraise 
error\nmsrest.exceptions.AuthenticationError: , SSLError: 
HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max 
retries exceeded with url: /*b4f64759-blah-blah*/oauth2/token (Caused by 
SSLError(SSLError(\"bad handshake: Error([('SSL routines', 
'ssl3_get_server_certificate', 'certificate verify failed')],)\",),))\n", 
"module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}


I am able to connect to azure via the azure CLI create VMs and such through 
a bash script, but I need to get this working with ansible.


My credentials file
[code]
subscription_id=5eff-blah-blah
client_id=83e09b01-blah-blah
secret=passwordblahblah
tenant=b4f64759-blah-blah
[/code]


Sample yml

[code] 
- name: whatever
  hosts: localhost
  connection: local

  tasks:
  - name: Create virtual network
azure_rm_virtualnetwork:
  resource_group: myResourceGroup
  name: myVnet
  address_prefixes: "10.10.0.0/16"

[/code]

I have even tried modifying my credentials file to include the azure AD 
username & password (yes, I know this is considered bad practice, but I got 
desperate) and it still fails with a certificate error:

[code]
ad_user=du...@dummy.com
password=DummyLab
subscription_id=5eff-blah-blah
[/code]

fatal: [192.168.0.177]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "From cffi callback :\nTraceback (most recent call last):\n  File 
\"/usr/lib/python2.7/site-packages/OpenSSL/SSL.py\", line 313, in 
wrapper\n_lib.X509_up_ref(x509)\nAttributeError: 'module' object has no 
attribute 'X509_up_ref'\nTraceback (most recent call last):\n  File 
\"/tmp/ansible_B6bKF3/ansible_module_azure_rm_virtualnetwork.py\", line 
354, in \nmain()\n  File 
\"/tmp/ansible_B6bKF3/ansible_module_azure_rm_virtualnetwork.py\", line 
351, in main\nAzureRMVirtualNetwork()\n  File 
\"/tmp/ansible_B6bKF3/ansible_module_azure_rm_virtualnetwork.py\", line 
206, in __init__\nsupports_check_mode=True)\n  File 
\"/tmp/ansible_B6bKF3/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\",
 
line 245, in __init__\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 367, in __init__\nself.set_token()\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 404, in set_token\nraise_with_traceback(AuthenticationError, \"\", 
err)\n  File \"/usr/lib/python2.7/site-packages/msrest/exceptions.py\", 
line 48, in raise_with_traceback\nraise 
error\nmsrest.exceptions.AuthenticationError: , SSLError: 
HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max 
retries exceeded with url: /common/oauth2/token (Caused by 
SSLError(SSLError(\"bad handshake: Error([('SSL routines', 
'ssl3_get_server_certificate', 'certificate verify failed')],)\",),))\n", 
"module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}


-- 
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/345e87d9-4799-4f26-9a43-865a5f4ca57b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] SSL/Certificate errors when running playbooks against Azure

2017-12-12 Thread JOS
Hello,

So I have an Azure free trial subscription and am trying to deploy VMs for 
it through ansible.  For reference, I mostly followed this guide: 
https://github.com/erjosito/ansible-azure-lab

I am unable to execute any playbook task at all, even something as simple 
as merely creating a resource group with a network.  Here is the error I 
always get:

fatal: [192.168.0.177]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "From cffi callback :\nTraceback (most recent call last):\n  File 
\"/usr/lib/python2.7/site-packages/OpenSSL/SSL.py\", line 313, in 
wrapper\n_lib.X509_up_ref(x509)\nAttributeError: 'module' object has no 
attribute 'X509_up_ref'\nTraceback (most recent call last):\n  File 
\"/tmp/ansible_uaTUwO/ansible_module_azure_rm_virtualnetwork.py\", line 
354, in \nmain()\n  File 
\"/tmp/ansible_uaTUwO/ansible_module_azure_rm_virtualnetwork.py\", line 
351, in main\nAzureRMVirtualNetwork()\n  File 
\"/tmp/ansible_uaTUwO/ansible_module_azure_rm_virtualnetwork.py\", line 
206, in __init__\nsupports_check_mode=True)\n  File 
\"/tmp/ansible_uaTUwO/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\",
 
line 235, in __init__\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 440, in __init__\nself.set_token()\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 473, in set_token\nraise_with_traceback(AuthenticationError, \"\", 
err)\n  File \"/usr/lib/python2.7/site-packages/msrest/exceptions.py\", 
line 48, in raise_with_traceback\nraise 
error\nmsrest.exceptions.AuthenticationError: , SSLError: 
HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max 
retries exceeded with url: /*b4f64759-blah-blah*/oauth2/token (Caused by 
SSLError(SSLError(\"bad handshake: Error([('SSL routines', 
'ssl3_get_server_certificate', 'certificate verify failed')],)\",),))\n", 
"module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}


I am able to connect to azure via the azure CLI create VMs and such through 
a bash script, but I need to get this working with ansible.


My credentials file

subscription_id=5eff-blah-blah
client_id=83e09b01-blah-blah
secret=passwordblahblah
tenant=b4f64759-blah-blah



Sample yml

- name: whatever
  hosts: localhost
  connection: local

  tasks:
  - name: Create virtual network
azure_rm_virtualnetwork:
  resource_group: myResourceGroup
  name: myVnet
  address_prefixes: "10.10.0.0/16"

I have even tried modifying my credentials file to include the azure AD 
username & password (yes, I know this is considered bad practice, but I got 
desperate) and it still fails with a certificate error:

ad_user=du...@dummy.com
password=DummyLab
subscription_id=5eff-blah-blah

fatal: [192.168.0.177]: FAILED! => {"changed": false, "failed": true, 
"module_stderr": "From cffi callback :\nTraceback (most recent call last):\n  File 
\"/usr/lib/python2.7/site-packages/OpenSSL/SSL.py\", line 313, in 
wrapper\n_lib.X509_up_ref(x509)\nAttributeError: 'module' object has no 
attribute 'X509_up_ref'\nTraceback (most recent call last):\n  File 
\"/tmp/ansible_B6bKF3/ansible_module_azure_rm_virtualnetwork.py\", line 
354, in \nmain()\n  File 
\"/tmp/ansible_B6bKF3/ansible_module_azure_rm_virtualnetwork.py\", line 
351, in main\nAzureRMVirtualNetwork()\n  File 
\"/tmp/ansible_B6bKF3/ansible_module_azure_rm_virtualnetwork.py\", line 
206, in __init__\nsupports_check_mode=True)\n  File 
\"/tmp/ansible_B6bKF3/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\",
 
line 245, in __init__\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 367, in __init__\nself.set_token()\n  File 
\"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", 
line 404, in set_token\nraise_with_traceback(AuthenticationError, \"\", 
err)\n  File \"/usr/lib/python2.7/site-packages/msrest/exceptions.py\", 
line 48, in raise_with_traceback\nraise 
error\nmsrest.exceptions.AuthenticationError: , SSLError: 
HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max 
retries exceeded with url: /common/oauth2/token (Caused by 
SSLError(SSLError(\"bad handshake: Error([('SSL routines', 
'ssl3_get_server_certificate', 'certificate verify failed')],)\",),))\n", 
"module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

-- 
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/82a4476e-bf1b-426d-8cbf-fa0c0b1ff393%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Is there a way to print a report at the end of an ansible run?

2017-12-12 Thread burton
I have an ansible setup that generates a set of clusters and their 
configuration.

I want to print (locally) a report showing which services were deployed, 
what their credentials were, etc.

debug won't work because the output it escaped so I get lots of \n\n ... 

a command with 'cat' won't work because it just prints 'success' .

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/9a7d3562-278b-401d-996c-bf3bd11b7164%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Is there a way to print a report at the end of an ansible run?

2017-12-12 Thread Matt Martz
You could write a callback plugin that aggregates that data, and prints out
on `v2_playbook_on_stats` similarly to the way the `PLAY RECAP` is output.

On Tue, Dec 12, 2017 at 3:39 PM,  wrote:

> I have an ansible setup that generates a set of clusters and their
> configuration.
>
> I want to print (locally) a report showing which services were deployed,
> what their credentials were, etc.
>
> debug won't work because the output it escaped so I get lots of \n\n ...
>
> a command with 'cat' won't work because it just prints 'success' .
>
> 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/9a7d3562-278b-401d-996c-bf3bd11b7164%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_g9YkXNcQYFK7DLz4rhNLv4B5oHv-K1MN-0A0ZEGNiWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Add conditional logic to variable files?

2017-12-12 Thread Robert Flaugher
I've been using Ansible Galaxy roles from Jeff Geerling.  In his Github 
READMEs he seems to say that you can override variable settings in his 
default/main.yml and vars/*.yml files by reproducing the desired settings 
in a /vars/main.yml file and then re-assigning them your desire 
values.  This works well but there are times when I'd like to use the 
following logic in that file:

# vars/main.yml
enable_setting: true
...


if enable_setting
   foo: bar
else
   baz: barf


Is this possible?  I didn't see this mentioned in the Ansible docs on 
Variables and Conditionals.

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/f5598744-d5e9-4add-9440-849f1d3a0332%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Not repeatable login error with winrm

2017-12-12 Thread Justin M
New to Ansbile and trying to do a POC and learn at the same time.  I'm 
using centos for my ansbile server and using the local admin account on 
windows when running my remote tasks.  I'm able to run a bunch of tasks 
like remotely installing MSIs and joining a domain and installing some 
features.  The first time I attempt to copy a file I get the below error.  
(I used the -vvv option to get some more verbose output).  What is weird is 
if I immediately run my playbook again it works and completes the rest of 
the tasks without issue.  I don't understand how this could be as this step 
is way after the domain join.  Currently I join the domain, reboot, add 
some roles reboot, and add some features all before this step.  I'm also 
not sure if the step that is failing is the win_copy or the script. Either 
way it runs the second time.  Any help would be appreciated. 

Steps in config
- name: Setup IIS/Certificate
  win_copy:
src: files/certs/mycert_2020.pfx
dest: C:\scripts\
- script: files/certs/install_cert.bat
  args:
creates: c:\scripts\certinstalled.txt



<10.152.2.137> PUT "/etc/ansible/files/certs/mycert.pfx" TO 
"C:\Users\Administrator\AppData\Local\Temp\ansible-tmp-1513116318.66-1186697384671\source"
Using module file 
/usr/lib/python2.7/site-packages/ansible/modules/windows/win_copy.ps1
EXEC (via pipeline wrapper)
The full traceback is:
Traceback (most recent call last):
  File 
"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 
125, in run
res = self._execute()
  File 
"/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 
521, in _execute
result = self._handler.run(task_vars=variables)
  File 
"/usr/lib/python2.7/site-packages/ansible/plugins/action/win_copy.py", line 
490, in run
copy_result = self._copy_single_file(file_src, dest, file_dest, 
task_vars)
  File 
"/usr/lib/python2.7/site-packages/ansible/plugins/action/win_copy.py", line 
281, in _copy_single_file
copy_result = self._execute_module(module_name="copy", 
module_args=copy_args, task_vars=task_vars)
  File 
"/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 
737, in _execute_module
res = self._low_level_execute_command(cmd, sudoable=sudoable, 
in_data=in_data)
  File 
"/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 
886, in _low_level_execute_command
rc, stdout, stderr = self._connection.exec_command(cmd, 
in_data=in_data, sudoable=sudoable)
  File 
"/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py", 
line 357, in exec_command
result = self._winrm_exec(cmd_parts[0], cmd_parts[1:], from_exec=True, 
stdin_iterator=stdin_iterator)
  File 
"/usr/lib/python2.7/site-packages/ansible/plugins/connection/winrm.py", 
line 308, in _winrm_exec
self.protocol.cleanup_command(self.shell_id, command_id)
  File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 314, in 
cleanup_command
res = self.send_message(xmltodict.unparse(req))
  File "/usr/lib/python2.7/site-packages/winrm/protocol.py", line 214, in 
send_message
return self.transport.send_message(message)
  File "/usr/lib/python2.7/site-packages/winrm/transport.py", line 229, in 
send_message
response = self._send_message_request(prepared_request, message)
  File "/usr/lib/python2.7/site-packages/winrm/transport.py", line 239, in 
_send_message_request
raise InvalidCredentialsError("the specified credentials were rejected 
by the server")
InvalidCredentialsError: the specified credentials were rejected by the 
server

fatal: [10.152.2.137]: FAILED! => {
"failed": true,
"msg": "Unexpected failure during module execution.",
"stdout": ""
}
to retry, use: --limit @/etc/ansible/ASGTEST.retry



-- 
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/3cd497fd-c62f-484b-855b-994c5fe750c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Templete statement that can qualify mulitiple inventory_hostname

2017-12-12 Thread Mike Johnston
I'm trying to figure out how to pass statement that will match multiple 
hostnames instead of just one.  I know how to do it with a group in the 
hosts file, but I need it to be something I set in the defaults part of the 
role.  I'm sure sure the answer is really easy but I'm just getting used to 
Jinja.   Here's my example...

*hosts file:*
[group1]
system1
system2
system3

roles/fubar/templates/mytest.j2

{% if inventory_hostname == "server1" %}
This is a test
{% endif %}

This works... but what if I want this line on server1 and server3?  
Preferably something a role assigned in defaults/main.yml file like:

ImportantServers: [ 'server1' , 'server3' ]

{% if inventory_hostname in groups[ 'ImportantServers'] %}
This is a test
{% endif %}

That doesn't work however.  I think it's because the groups is referring to 
the hosts file and not looking at the defaults.   If someone could tell me 
what I'm doing wrong and not shame me too badly that would be great.

-- 
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/9ff24759-4e98-49db-b66a-5234b5450dfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Not repeatable login error with winrm

2017-12-12 Thread Jordan Borean
If the previous task before the copy one is to install some features and 
reboot then potentially the WinRM service comes back online but it reboots 
one more time that isn't caught. What I would potentially do is


- name: install problematic features
  win_feature:
name: ...
  register: feature_install


- name: reboot after feature install
  win_reboot:
  when: feature_install.reboot_required


- block:
  - name: copy file
win_copy:
  src: files/certs/mycert_2020.pfx
  dest: C:\scripts\


  rescue:
  - name: copy failed wait for connection to become stable
wait_for_connection:


  - name: copy the file again
win_copy:
  src: files/certs/mycert_2020.pfx
  dest: C:\scripts\


- name: run setup script
  script: files/certs/install_cert.bat
  args:
creates: c:\scripts\certinstalled.txt


The block/rescue may not work as the failure happened in the connection 
plugin and not the module and this usually is a fatal exception that is not 
recoverable. But because win_copy is an action plugin it may work I just 
can't confirm right now. If it doesn't work then you may need to look into 
the logs a bit more to see why it may be rejecting your credentials or as a 
precaution put a pause after the win_reboot step and then 
wait_for_connection straight after to try and catch these exceptions.

-- 
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/a8a7682e-177f-46db-b57b-d283a1c42eda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Not repeatable login error with winrm

2017-12-12 Thread Jordan Borean
Actually after looking at the error it does still seem to be a fatal error 
so I don't think the block/rescue will work in this case so I think putting 
wait_for_connection after your reboot stage might be best.

-- 
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/bbd2a306-c2e9-4d82-9e08-c8b509411c02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: WinRM configuration script

2017-12-12 Thread Maverick Sevmont
Thanks Trond and Matt! I just saw your reply, never got any kind of 
notification from google!!! I thought I had checked the box to send me the 
updates. I ended up building a script using PsExec to accomplish this, but 
currently I am into building UI tools for other folks, so I will definitely 
revisit and look into Trond´s. Thanks a ton for your quick reply, sorry for 
the late thanks! 

Erick

On Sunday, March 26, 2017 at 3:32:27 PM UTC-6, Trond Hindenes wrote:
>
> I'm assuming that's the one Erick mentions. Erick, that got merged in and 
> has now taken of its own with changes from a bunch of people. 
> It's also referenced in the docs: 
> http://docs.ansible.com/ansible/intro_windows.html#windows-system-prep
>
> On Thursday, March 16, 2017 at 7:45:40 PM UTC+1, Matt Davis wrote:
>>
>> You mean this one 
>> ?
>>  
>> ;)
>>
>> On Thursday, March 16, 2017 at 11:43:11 AM UTC-7, Erick Sevmont wrote:
>>>
>>> Hi Trond! 
>>>
>>> I'm very interested, I just joined a project where I need this exactly, 
>>> wondering if you still have that available, the link sends 404, I snooped a 
>>> bit in https://github.com/trondhindenes but I didn't see it! Would you 
>>> mind sharing this again if you have it handy?
>>>
>>> Thanks! Erick
>>>
>>> On Saturday, July 5, 2014 at 10:56:59 AM UTC-5, Trond Hindenes wrote:

 If anyone else in here are interested in Windows support, I've 
 published an updated version of the winrm configuration script which 
 basically performs a fire-and-forget setup of WinRM for https.

 I'm trying to be as smart as possible and do as little as possible, so 
 if WinRM over https is already enabled (like it is on VMs running in 
 Azure) 
 i'm skipping that part. The script should also work on Windows 2008R2 
 hosts 
 where PowerShell 3.0 is enabled (I've made that a hard requirement as 
 Ansible won't run on lower versions of PowerShell).

 In any case, I'd be happy to take feedback on it, and if Michael wants 
 to add this to the "scripts" folder inside the source at some point then 
 I'd be all for that of course.

 https://gist.github.com/trondhindenes/b9b5b25b11273cc35659




-- 
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/1f80891c-6b93-4043-b329-12622212aa94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Integrate ansible in CI/CD tools

2017-12-12 Thread Helio Campos Mello de Andrade
Hi guys,

 - I'm trying to integrate an ansible playbook with my CI/CD tool 
(GOCD https://www.gocd.org/). It happens I have to pass a complex data 
structure (a hash with lists of hashes) to it and don't know how to do it. 
As almost all information in this hash are secrets and login stuff, I'm 
trying to get the information from a hashicorp's vault. Do someone have a 
tutorial on how to integrate ansible with vault and pass several 
informations without having to pass it via extra-vars in the command line?

Best regards,

-- 
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/0213b671-f1bb-48d5-9b92-39ac3a4ab741%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Ansible AWS EC2 create scripts gives this error:: "Timeout when waiting for 172.31.25.6:22"}

2017-12-12 Thread Ajay Sharma


My Ansible AWS EC2 instance creation script gives this error. 

"Timeout when waiting for 172.31.25.6:22"}
to retry, use: --limit @/root/instance/provision-ec2.retry

this code is causing problem, Please let me know, how to solve this. 




*- name: Wait for the instances to boot by checking the ssh port   wait_for: 
host={{item.public_ip}} port=22 delay=60 timeout=220 state=started with_items: 
"{{ ec2.instances }}" ~ *
here is the entire code. 
###
---
 - name: Provision EC2 Box
   local_action:
 module: ec2
 key_name: "{{ ec2_keypair }}"
 group_id: "{{ ec2_security_group }}"
 instance_type: "{{ ec2_instance_type }}"
 image: "{{ ec2_image }}"
 vpc_subnet_id: "{{ ec2_subnet_ids|random }}"
 region: "{{ ec2_region }}"
 instance_tags: 
'{"Name":"{{ec2_tag_Name}}","Type":"{{ec2_tag_Type}}","Environment":"{{ec2_tag_Environment}}"}'
 assign_public_ip: yes
 wait: true
 count: 1
 volumes:
 - device_name: /dev/sda1
   device_type: gp2
   volume_size: "{{ ec2_volume_size }}"
   delete_on_termination: true
   register: ec2

 - debug: var=item
   with_items: "{{ ec2.instances }}"

 - add_host: name={{ item.public_ip }} >
 
groups=tag_Type_{{ec2_tag_Type}},tag_Environment_{{ec2_tag_Environment}}
 ec2_region={{ec2_region}}
 ec2_tag_Name={{ec2_tag_Name}}
 ec2_tag_Type={{ec2_tag_Type}}
 ec2_tag_Environment={{ec2_tag_Environment}}
 ec2_ip_address={{item.public_ip}}
   with_items: "{{ ec2.instances }}"

 - name: Wait for the instances to boot by checking the ssh port
   wait_for: host={{item.public_ip}} port=22 delay=60 timeout=220 state=started
   with_items: "{{ ec2.instances }}"
~
#
Regards,
Ajay

-- 
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/2a8a7fc4-091c-498b-a794-c009695e37df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Templete statement that can qualify mulitiple inventory_hostname

2017-12-12 Thread Kai Stian Olstad

On 12.12.2017 23:56, Mike Johnston wrote:

*hosts file:*
[group1]
system1
system2
system3

roles/fubar/templates/mytest.j2

{% if inventory_hostname == "server1" %}
This is a test
{% endif %}

This works... but what if I want this line on server1 and server3?
Preferably something a role assigned in defaults/main.yml file like:

ImportantServers: [ 'server1' , 'server3' ]

{% if inventory_hostname in groups[ 'ImportantServers'] %}
This is a test
{% endif %}

That doesn't work however.  I think it's because the groups is 
referring to
the hosts file and not looking at the defaults.   If someone could tell 
me

what I'm doing wrong and not shame me too badly that would be great.


Since ImportantServers is in defaults it's a variable and not a group, 
so just lose the groups.
Groups is something you define in inventory or with the module group_by 
and add_host.


{% if inventory_hostname in ImportantServers %}
This is a test
{% endif %}

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


[ansible-project] Ansible 2.4 gathering facts stuck

2017-12-12 Thread Mona Gopal
Hi,

Ansible2.4 is setup on CentOS7.4. 
The playbook execution gets stuck(for more than 5 mins) at gathering facts 
at times and few of the times it runs smoothly. 
What could be the reason for it? 

Regards,
Mona G

-- 
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/cca72bb6-50ad-4d65-a792-04025fd4809c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] reading from files

2017-12-12 Thread coach rhca
Thanks Kai for the help always..will check on this ...

On Tue, Dec 12, 2017 at 11:04 PM, Kai Stian Olstad <
ansible-project+l...@olstad.com> wrote:

> On Tuesday, 12 December 2017 07.28.53 CET coach.r...@gmail.com wrote:
> > Hi,
> >
> > Trying to read the values from flat files and to use it as a variables in
> > the ansible playbook , for example
> >
> > the flatfile is
> > #cat output
> >
> >  example.com/development/testcaseone:v99
> >
> > I want to use above values as a variables in the playbook , just like
> > ---
> > - hosts:
> >   vars:
> > rt1: example.com
> > stage_name: development
> > job_name: testcaseone
> > version_number: v99
> >
> >
> > I tried with lookup ('file', /path/to/output) but it gives the entire
> > output of the value..
>
> Not tested but something like this might work.
>
>   - fetch:
>   src: /path/to/file
> register: r
>
>   - set_fact:
>   rt1: '{{ (r.content | b64decode).split('/')[0] }}'
>   stage_name: '{{ (r.content | b64decode).split('/')[1] }}'
>   job_name: '{{ (r.content | b64decode).split('/')[2].split(':')[0]
> }}'
>   version_number: '{{ (r.content | b64decode).split('/')[2].split(':')[1]
> }}'
>
>
> --
> Kai Stian Olstad
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/OipBBxJ_NNc/unsubscribe.
> To unsubscribe from this group and all its topics, 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/2024833.PQvOlT6LQd%40x1.
> For more options, visit https://groups.google.com/d/optout.
>

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