[ansible-project] Re: WINRM Connection always ends up with "STDERR An error occurred while creating the pipeline"

2018-01-28 Thread Jeremie Levy
Thank you Jordan, really appreciate.
I am still not sure it doesn't affect module execution, i have some issues 
executing win_package. Maybe not related.

On Monday, January 29, 2018 at 9:33:23 AM UTC+2, Jordan Borean wrote:
>
> This is a known issue, technically an error did occur but it does not 
> affect the actual module execution. It was fixed a while ago in the devel 
> branch for the 2.5 release but was only recently back ported to 2.4 and 
> will be available in the 2.4.4 release.
>
> 2.5 commit
>
>
> https://github.com/ansible/ansible/commit/7fce636c2b250aa6ffd7322f03a0c982ecd802e3#diff-9b6915232549a7bcd00b8b8f142b7232
>
> 2.4.4 commit
>
>
> https://github.com/ansible/ansible/commit/e27847eda8d1ea05da8a1b96e085f41134faff94
>
> Thanks
>
> 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/cf8d45a1-b496-4140-9b2f-e970f483b55f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: WINRM Connection always ends up with "STDERR An error occurred while creating the pipeline"

2018-01-28 Thread Jordan Borean
This is a known issue, technically an error did occur but it does not 
affect the actual module execution. It was fixed a while ago in the devel 
branch for the 2.5 release but was only recently back ported to 2.4 and 
will be available in the 2.4.4 release.

2.5 commit

https://github.com/ansible/ansible/commit/7fce636c2b250aa6ffd7322f03a0c982ecd802e3#diff-9b6915232549a7bcd00b8b8f142b7232

2.4.4 commit

https://github.com/ansible/ansible/commit/e27847eda8d1ea05da8a1b96e085f41134faff94

Thanks

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/2ac723bb-f3b1-4c39-922b-b0bbbf60937a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] WINRM Connection always ends up with "STDERR An error occurred while creating the pipeline"

2018-01-28 Thread Jeremie Levy

Hi
Any task i run is followed by this WINRM error
I am not sure it's an error since the task is done successfully, does 
someone knows about this?

TASK [Create KIT folder if missing] 

task path: /ansible/scripts/vs2012.yaml:5
Using module file 
/usr/lib/python2.7/dist-packages/ansible/modules/windows/win_file.ps1
 ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO 
hasjrwts02
creating Kerberos CC at /tmp/tmpnaEGzD
calling kinit for principal ansible
Using module file 
/usr/lib/python2.7/dist-packages/ansible/modules/windows/win_file.ps1
 ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO 
hasjrwts01
creating Kerberos CC at /tmp/tmpDGNECq
calling kinit for principal ansible
kinit succeeded for principal ansible
 WINRM CONNECT: transport=kerberos 
endpoint=https://hasjrwts02:5986/wsman
kinit succeeded for principal ansible
 WINRM CONNECT: transport=kerberos 
endpoint=https://hasjrwts01:5986/wsman
 WINRM OPEN SHELL: F95EFA87-3A14-4F69-AC9B-2BD43120BC93
EXEC (via pipeline wrapper)
 WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', 
'-ExecutionPolicy', 'Unrestricted', '-']
 WINRM OPEN SHELL: 421A5D1E-4BC3-42C9-8E02-4B8F28EBDDD7
EXEC (via pipeline wrapper)
 WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive', 
'-ExecutionPolicy', 'Unrestricted', '-']
 WINRM RESULT u''
 WINRM STDOUT {"changed":true}

 WINRM STDERR An error occurred while creating the pipeline.
+ CategoryInfo  : NotSpecified: (:) [], 
ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RuntimeException


 WINRM CLOSE SHELL: F95EFA87-3A14-4F69-AC9B-2BD43120BC93
 WINRM RESULT u''
 WINRM STDOUT {"changed":true}

 WINRM STDERR An error occurred while creating the pipeline.
+ CategoryInfo  : NotSpecified: (:) [], 
ParentContainsErrorRecordException
+ FullyQualifiedErrorId : RuntimeException


 WINRM CLOSE SHELL: 421A5D1E-4BC3-42C9-8E02-4B8F28EBDDD7
changed: [hasjrwts02] => {
"changed": true
}
changed: [hasjrwts01] => {
"changed": true
}



-- 
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/6d68add6-6f0e-42c7-8542-8c57cd67f6e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: [Windows] Install visual studio

2018-01-28 Thread Jeremie Levy
To avoid this issue and since my user is already admin on the server, i've 
just download the file first instead of installing over http url.
Thanks!

On Sunday, January 28, 2018 at 6:59:33 PM UTC+2, Varun Chopra wrote:
>
> Yes, and?

-- 
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/886349bd-5014-4e32-b271-b474c27a3ebd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Simple cisco IOS show version

2018-01-28 Thread Surjeet Singh
Thank you for your response.

I also managed to fix this by modifying my code little bit
.I will share my updated code with you..

Regards/Surjeet

On 29-Jan-2018 2:51 AM, "Claudia de Luna"  wrote:

> Hi Surjeet,
>
> I have a script that is very similar to yours.  I pass it either a file or
> a path to a directory full of individual files per device with all the show
> command output.
>
> I take the output of each file and append it to a list, fsm_all_results.
> Once done processing either one file or a directory full of files, i save
> fsm_all_results to a CSV file.
>
> Hope this helps!
>
> Good luck.
>
> # Make sure we have files to process (at least 1)
> if len(file_list) > 0:
>
> # Open the CSV file to store results
> csv_results_fh = open_file(results_dir, 'wb')
> csv_writer = csv.writer(csv_results_fh, quoting=csv.QUOTE_MINIMAL)
>
> # Iterate through the valid file list. If the script was passed a 
> filename it will be a file_list of 1
> # If the script was passed a directory it will be a list of files with a 
> valid extension
> for fil in file_list:
>
> print("Processing device file: " + fil)
>
> # open_file function returns a file handle
> fh = open_file(fil, 'r')
>
> # Read the file contents into a variable for parsing
> file_contents = fh.read()
> # Close file
> fh.close()
>
> # Send TextFSM Template name and data to parse to text_fsm_parsing 
> function
> # file_results returns the parsed results and table returns the header
> fil_results, table = text_fsm_parse(textfsm_template, file_contents)
> print("file results of lenght {} from 
> text_fsm_parse:\n{}".format(str(len(fil_results)),fil_results[1]))
>
> # Append fil_results list of results to list of all results
> fsm_all_results.append(fil_results)
>
> # Keep track of files without parser output in the no_output list so 
> it can be printed later
> if len(fil_results) == 0:
> no_output.append(fil)
>
>
>
> # Write the header row in the CSV file
> if table:
> csv_writer.writerow(table.header)
> else:
> sys.exit("Parsing Error. Execution aborted.")
>
> # Write each row in the fsm_all_results list to the CSV file
> for re_row in fsm_all_results:
> for single_row in re_row:
> csv_writer.writerow(single_row)
> # print(single_row)
>
>
>
>
>
>
>
>
> On Saturday, January 27, 2018 at 6:29:25 AM UTC-8, Surjeet Singh wrote:
>>
>> Hi Claudia,
>>
>> i am strugling with with issue in putting textfsm in loop. i can read all
>> my file end with .txt but i have issue in moving for loop so i can run
>> textfsml on all files instead of last file.
>>
>> can you please help me with that.
>>
>> import jtextfsm as textfsm
>> import glob, os
>>
>> os.chdir("/etc/ansible/facts/")
>> for file in glob.glob("*_iosfacts.txt"):
>> input_file = open(file)
>> raw_text_data = input_file.read()
>> input_file.close()
>>
>> # Run the text through the FSM.
>> # The argument 'template' is a file handle and 'raw_text_data' is a
>> # string with the content from the show_inventory.txt file
>> template = open("/etc/ansible/parse-inventory-with-textfsm/show_invento
>> ry_multiple.textfsm")
>> re_table = textfsm.TextFSM(template)
>> fsm_results = re_table.ParseText( raw_text_data)
>>
>> # the results are written to a CSV file
>> outfile_name = open("/etc/ansible/parse-inventory-with-textfsm//outfile.csv",
>> "w+")
>> outfile = outfile_name
>>
>> # Display result as CSV and write it to the output file
>> # First the column headers...
>> print(re_table.header)
>> for s in re_table.header:
>> outfile.write("%s;" % s)
>> outfile.write("\n")
>>
>> # ...now all row's which were parsed by TextFSM
>> counter = 0
>> for row in fsm_results:
>> print(row)
>> for s in row:
>> outfile.write("%s;" % s)
>> outfile.write("\n")
>> counter += 1
>> print("Write %d records" % counter)
>>
>> Regards,
>> *Surjeet Singh*
>> Technical Specialist – Networks DATA
>> CCNA, CCNP(R&S)
>> Cell : +917838707047
>>
>> To become bigger person,need to walk with bigger Vision 
>>
>> On Thu, Jan 25, 2018 at 12:27 AM, Claudia de Luna 
>> wrote:
>>
>>> Hi Surjeet,
>>>
>>> There are a couple of ways to approach this.
>>>
>>> What I typically do is save a file of show commands for each device and
>>> then process those files using TextFSM.
>>>
>>> - local_action: copy content="{{ output }}" dest="./FACTs/{{
>>> inventory_hostname }}-facts.txt"
>>>
>>> To basically concatenate to one file I suspect it would have to involve
>>> set_fact and some processing..maybe a template.
>>>
>>> If I get some time I'll see if I can come up with something that makes
>>> sense.
>>>
>>> Claudia
>>>
>>>
>>>
>>> On Tue, Jan 23, 2018 at 10:51 PM, Surjeet Singh 
>>> wrote:
>>>
 Thank you for your response. Please excuse me for my multiple question
 i am new to this programm

[ansible-project] Documentation Tool for Ansible Role

2018-01-28 Thread Mohit Dhingra
Hi Ansible Users, Is there any documentation tool for available for Ansible 
role. I have created a role and i want to document it. 

-- 
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/2d8935dc-6582-475d-bfdd-7486f7516ad1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to display ansible_host in console output even if an alias is defined at inventory level

2018-01-28 Thread Russell Yorke
Hey

Why not put a debug statement at the beginning of your play that outputs the 
ansible_hostname? That way you can a one-to-one mapping in your output and you 
can reference that to figure out what system each refers to? Just a thought.

-- 
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/8ba1e7ef-6aad-4c57-8a39-3c61ee497718%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: Simple cisco IOS show version

2018-01-28 Thread Claudia de Luna
Hi Surjeet,

I have a script that is very similar to yours.  I pass it either a file or 
a path to a directory full of individual files per device with all the show 
command output.

I take the output of each file and append it to a list, fsm_all_results.  
Once done processing either one file or a directory full of files, i save 
fsm_all_results to a CSV file.

Hope this helps!

Good luck.

# Make sure we have files to process (at least 1)
if len(file_list) > 0:

# Open the CSV file to store results
csv_results_fh = open_file(results_dir, 'wb')
csv_writer = csv.writer(csv_results_fh, quoting=csv.QUOTE_MINIMAL)

# Iterate through the valid file list. If the script was passed a filename 
it will be a file_list of 1
# If the script was passed a directory it will be a list of files with a 
valid extension
for fil in file_list:

print("Processing device file: " + fil)

# open_file function returns a file handle
fh = open_file(fil, 'r')

# Read the file contents into a variable for parsing
file_contents = fh.read()
# Close file
fh.close()

# Send TextFSM Template name and data to parse to text_fsm_parsing 
function
# file_results returns the parsed results and table returns the header
fil_results, table = text_fsm_parse(textfsm_template, file_contents)
print("file results of lenght {} from 
text_fsm_parse:\n{}".format(str(len(fil_results)),fil_results[1]))

# Append fil_results list of results to list of all results
fsm_all_results.append(fil_results)

# Keep track of files without parser output in the no_output list so it 
can be printed later
if len(fil_results) == 0:
no_output.append(fil)



# Write the header row in the CSV file
if table:
csv_writer.writerow(table.header)
else:
sys.exit("Parsing Error. Execution aborted.")

# Write each row in the fsm_all_results list to the CSV file
for re_row in fsm_all_results:
for single_row in re_row:
csv_writer.writerow(single_row)
# print(single_row)








On Saturday, January 27, 2018 at 6:29:25 AM UTC-8, Surjeet Singh wrote:
>
> Hi Claudia,
>
> i am strugling with with issue in putting textfsm in loop. i can read all 
> my file end with .txt but i have issue in moving for loop so i can run 
> textfsml on all files instead of last file.
>
> can you please help me with that.
>
> import jtextfsm as textfsm
> import glob, os
>
> os.chdir("/etc/ansible/facts/")
> for file in glob.glob("*_iosfacts.txt"):
> input_file = open(file)
> raw_text_data = input_file.read()
> input_file.close()
>
> # Run the text through the FSM. 
> # The argument 'template' is a file handle and 'raw_text_data' is a 
> # string with the content from the show_inventory.txt file 
> template = 
> open("/etc/ansible/parse-inventory-with-textfsm/show_inventory_multiple.textfsm")
> re_table = textfsm.TextFSM(template)
> fsm_results = re_table.ParseText( raw_text_data)
>
> # the results are written to a CSV file
> outfile_name = 
> open("/etc/ansible/parse-inventory-with-textfsm//outfile.csv", "w+")
> outfile = outfile_name
>
> # Display result as CSV and write it to the output file
> # First the column headers...
> print(re_table.header)
> for s in re_table.header:
> outfile.write("%s;" % s)
> outfile.write("\n")
>
> # ...now all row's which were parsed by TextFSM
> counter = 0
> for row in fsm_results:
> print(row)
> for s in row:
> outfile.write("%s;" % s)
> outfile.write("\n")
> counter += 1
> print("Write %d records" % counter)
>
> Regards,
> *Surjeet Singh*
> Technical Specialist – Networks DATA
> CCNA, CCNP(R&S)
> Cell : +917838707047
>
> To become bigger person,need to walk with bigger Vision 
>
> On Thu, Jan 25, 2018 at 12:27 AM, Claudia de Luna  > wrote:
>
>> Hi Surjeet,
>>
>> There are a couple of ways to approach this.
>>
>> What I typically do is save a file of show commands for each device and 
>> then process those files using TextFSM.
>>
>> - local_action: copy content="{{ output }}" dest="./FACTs/{{ 
>> inventory_hostname }}-facts.txt"
>>
>> To basically concatenate to one file I suspect it would have to involve 
>> set_fact and some processing..maybe a template.
>>
>> If I get some time I'll see if I can come up with something that makes 
>> sense.  
>>
>> Claudia
>>
>>
>>
>> On Tue, Jan 23, 2018 at 10:51 PM, Surjeet Singh > > wrote:
>>
>>> Thank you for your response. Please excuse me for my multiple question i 
>>> am new to this programming world.
>>>
>>> now i manage to collect the facts using the ansible get_fact module. i 
>>> will further spend time today for regular expression.
>>>
>>> my playbook looks like below:
>>>
>>> ---
>>> - name: collect device facts and display OS version
>>>   hosts: "{{ inventory | default('all') }}"
>>>   gather_facts: false
>>>   connection: local
>>>   ignore_errors: yes
>>>   
>>>

Re: [ansible-project] Ansible zabbix module issues

2018-01-28 Thread Andrew Morgan
I can also see something is happening on the zabbix server when the 
playbook runs

zabbix ansible-pip: Invoked with virtualenv=None virtualenv_site_packages=
False virtualenv_command=virtualenv chdir=None requirements=None name=[
'zabbix-api'] virtualenv_python=None editable=False umask=None executable=
None use_mirrors=True extra_args=None state=present version=None
Jan 28 15:52:32 zabbix ansible-zabbix_maintenance: Invoked with 
http_login_password=NOT_LOGGING_PARAMETER name=Zabbix123 
server_url=http://zabbix.socialpatrol.net 
login_user=Admin http_login_user=None timeout=10 host_names=None 
state=present host_groups=['Discovered host', 'Linux servers'] 
login_password=NOT_LOGGING_PARAMETER collect_data=True minutes=90 
desc=Setting up maintenance window for builds

But nothing really happens 


On Saturday, January 27, 2018 at 7:34:41 PM UTC-5, Andrew Morgan wrote:
>
> Thank you for your response..
> Yes, from what I can see there are multiple versions, 
>
> whereis python
>
> python: /usr/bin/python2.6 /usr/bin/python /usr/bin/python2.6-config /usr/
> lib/python2.6 /usr/lib64/python2.6 /usr/local/bin/python /usr/local/bin/
> python2.7-config /usr/local/bin/python2.7 /usr/local/lib/python2.7 /usr/
> include/python2.6 /usr/share/man/man1/python.1.gz
>
> [root@zabbix ~]# which python
> /usr/local/bin/python
>
> [root@zabbix ~]# /usr/local/bin/python --version
> Python 2.7
>
>
> ]# python
> pythonpython2.6 python2.7 python-config
> python2   python2.6-config  python2.7-config  
>
>
>
>
>
> On Saturday, 27 January 2018 14:31:33 UTC-5, Malcolm Hussain-Gambles wrote:
>>
>> The only thing I can think is on the
>> Zabbix server the version of python sensible is using isn't 2.7 but some 
>> other one? Is there another python installed on the zabbix server??
>>
>> That's a wild guess btw
>>
>

-- 
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/02d19358-6d5a-44bf-ad98-199e76e97dab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: How to display ansible_host in console output even if an alias is defined at inventory level

2018-01-28 Thread Julio Fernandez
Thanks, Varun!

Got it, but even so, imagine that we suddenly remove one of the so the 
inventory would initially look like this:

Inventory file

[my_jboss_servers]
jboss_server1 ansible_host=IP1
jboss_server3 ansible_host=IP3
jboss_server4 ansible_host=IP4


And if I run the playbook, I'll see something like this:

$ ansible-playbook myplaybook.yml -i inventory/my_inventory

PLAY [all] *

TASK [Gathering Facts] *
ok: [jboss_server1]
ok: [jboss_server3]
ok: [jboss_server4]

TASK [Task 1 : Create home directory if it does not exist] ***
ok: [jboss_server1]
ok: [jboss_server3]
ok: [jboss_server4]


Which I think might be confusing, initially as the first question would be: 
"what abour jboss_server2"? so I guess I'm trying to find a way to balance 
both, maintenance and clarity


Regards. 

El domingo, 28 de enero de 2018, 8:55:58 (UTC-8), Varun Chopra escribió:
>
> I think it's best to reserve ansible_host as the IP address as that 
> remains constant. You can declare friendly names first that way:
>
> jboss_1 ansible_host=10.0.0.10
>
> Going by your method, your inventory will require a lot of upkeep because 
> if the hostname changes, the inventory will break.
>
>

-- 
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/833a6401-1f4f-4cd2-82f3-03842287e923%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: [Windows] Install visual studio

2018-01-28 Thread Varun Chopra
Yes, and?

-- 
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/ab52b6af-c159-49f8-9507-72f0654eab0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] How to display ansible_host in console output even if an alias is defined at inventory level

2018-01-28 Thread Varun Chopra
I think it's best to reserve ansible_host as the IP address as that remains 
constant. You can declare friendly names first that way:

jboss_1 ansible_host=10.0.0.10

Going by your method, your inventory will require a lot of upkeep because if 
the hostname changes, the inventory will break.

-- 
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/a02a1678-40c8-4292-ad5b-6272508aac12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] service module fails to start nginx usig a docker connection

2018-01-28 Thread Varun Chopra
Run both using - and post the outputs here.

-- 
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/58ceb438-bfca-4e6e-bb0e-a2490c2effb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: [Windows] Install visual studio

2018-01-28 Thread Varun Chopra
That's not how become works. You can set become: yes at the task and play 
level, not module level.

-- 
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/77463337-021c-4596-8e26-0196f2069654%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ansible-project] Re: [Windows] Install visual studio

2018-01-28 Thread Jeremie Levy
Seems there is no become in the win_package module...

On Thu, Jan 25, 2018 at 11:03 PM, 'J Hawkesworth' via Ansible Project <
ansible-project@googlegroups.com> wrote:

> I have successfully installed visual studio using win_chocolatey in the
> past (with become escalating to run as local administrator).  Might be
> worth trying that.
> I suspect running with become might fix your problem as clearly its upset
> about having access to C:\\Users\\ansible\\r4muzag1.gdd
>
> Hope this is some help,
>
> Jon
>
> On Thursday, January 25, 2018 at 10:25:47 AM UTC, Jeremie Levy wrote:
>>
>> Hi
>>
>> It seems i need to wait a bit after the Visual studio installation.
>> It stated as failed because it couldn't remove the temporary install file
>> (web install file) - VS was installed !
>>
>> I'm using win_package and i'm not interested in using the raw module
>> since i need the win_package capabilities.
>> A workaround would be to have: if you can't remove the file, it's not a
>> failure and keep going (which i don't know how to do yet :))
>>
>> task path: /ansible/scripts/vs2012.yaml:23
>>
>>
>>
>> Using module file /usr/lib/python2.7/dist-packag
>> es/ansible/modules/windows/win_package.ps1
>>
>>
>>
>>  ESTABLISH WINRM CONNECTION FOR USER: ansible on PORT 5986 TO
>> hasjrwts02
>> creating Kerberos CC at /tmp/tmpJ_QHmz
>>
>>
>>
>>
>> calling kinit for principal ansible
>>
>>
>>
>>
>> kinit succeeded for principal ansible
>>
>>
>>
>>
>>  WINRM CONNECT: transport=kerberos endpoint=
>> https://hasjrwts02:5986/wsman
>>
>>
>>  WINRM OPEN SHELL: 23C2DB3A-DC34-4DA0-A019-7CD45579D735
>>
>>
>>
>> EXEC (via pipeline wrapper)
>>
>>
>>
>>
>>  WINRM EXEC 'PowerShell' ['-NoProfile', '-NonInteractive',
>> '-ExecutionPolicy', 'Unrestricted', '-']
>>
>>
>>  WINRM RESULT u'> occurred wh">'
>>
>>
>>
>>  WINRM STDOUT
>>
>>
>>
>>  WINRM STDERR An error occurred while creating the pipeline.
>>
>>
>>
>> + CategoryInfo  : NotSpecified: (:) [],
>> ParentContainsErrorRecordException
>>
>>
>>
>> + FullyQualifiedErrorId : RuntimeException
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Exception calling "Run" with "1" argument(s): "Exception calling "Invoke"
>> with "0" argument(s): "The running command
>>
>>
>>
>> stopped because the preference variable "ErrorActionPreference" or common
>> parameter is set to Stop: Cannot remove item
>>
>>
>>
>> C:\Users\ansible\r4muzag1.gdd: Access to the path
>> 'C:\Users\ansible\r4muzag1.gdd' is denied.""
>>
>>
>>
>> At line:47 char:5
>>
>>
>>
>>
>> + $output = $entrypoint.Run($payload)
>>
>>
>>
>>
>> + ~~~
>>
>>
>>
>>
>> + CategoryInfo  : NotSpecified: (:) [],
>> ParentContainsErrorRecordException
>>
>>
>>
>> + FullyQualifiedErrorId : ScriptMethodRuntimeException
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>  WINRM CLOSE SHELL: 23C2DB3A-DC34-4DA0-A019-7CD45579D735
>> fatal: [hasjrwts02]: FAILED! => {
>> "changed": false,
>>
>> "module_stderr": "An error occurred while creating the pipeline.\r\n
>>   + CategoryInfo  : NotSpecified: (:) [],
>> ParentContainsErrorRecordException\r\n+ FullyQualifiedErrorId :
>> RuntimeException\r\n \r\nException calling \"Run\" with \"1\" argument(s):
>> \"Exception calling \"Invoke\" with \"0\" argument(s): \"The running
>> command \r\nstopped because the preference variable
>> \"ErrorActionPreference\" or common parameter is set to Stop: Cannot remove
>> item \r\nC:\\Users\\ansible\\r4muzag1.gdd: Access to the path
>> 'C:\\Users\\ansible\\r4muzag1.gdd' is denied.\"\"\r\nAt line:47
>> char:5\r\n+ $output = $entrypoint.Run($payload)\r\n+
>>  ~~~\r\n+ CategoryInfo  :
>> NotSpecified: (:) [], ParentContainsErrorRecordException\r\n+
>> FullyQualifiedErrorId : ScriptMethodRuntimeException\r\n \r\n",
>>
>>
>> "module_stdout": "",
>>
>>
>>
>>
>> "msg": "MODULE FAILURE",
>>
>>
>>
>>
>> "rc": 1
>>
>>
>>
>>
>> }
>>
>>
>>
>>
>> to retry, use: --limit @/ansible/scripts/vs2012.retry
>>
>>
>>
>> Any idea please :) ?
>>
>>
>> --
> 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/7kWJpzbcnDo/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/b64c50f9-e825-4b1e-9ff7-2a097ac963f6%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 e

Re: [ansible-project] Simple YAMl File syntax errors

2018-01-28 Thread Dave Cottlehuber
On Sun, 28 Jan 2018, at 10:39, Mallireddy Gangadhar Reddy wrote:
> Hi ,
> 
> I have written a simple yaml file to install httpd package
> 
> --- 
> hosts: all
> tasks: 
>   yum: "name=httpd state=installed"
> 
> 
> i checked the syntax at http://www.yamllint.com/ , and it looks good. But 
> when i run it in the system it throws errors
> 
> [root@appserver ~]# ansible-playbook Play_Tomcat.yml 
> ERROR! playbooks must be a list of plays

Welcome Mallireddy.

Your yaml file is a _role_ and the playbook command requires a _playbook_ as 
well as an inventory file. You just need to add  a playbook (lets call that 
site.yml) and include your role from above (web.yml).

I tweaked your role a little (use separate lines so that git diffs are easy to 
read, add a name for readability during playbook runs, and tags to allow 
targeting tasks easily) but its basically the same as what you already have. I 
keep all of this together in a single git repo, along with ansible.cfg and 
hosts inventory file.

Your ansible structure should look like this inside your ansible repo:

```
# ./site.yml:
---
- hosts: all
  roles:
- web

# ./roles/web/tasks/main.yml:
--- 
- name: ensure web server is installed
  yum:
name: httpd
state: installed
  tags:
- web
- yum
```

I use the following a lot - what would the play change, and then actually apply 
it:

ansible-playbook site.yml --diff -v --check
ansible-playbook site.yml --diff -v

https://github.com/ansible/ansible-examples/tree/master/lamp_simple is a nice 
simple example pretty close to what you are using - enjoy.

A+
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/1517134751.2785594.1250673816.3ECD7BDA%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Simple YAMl File syntax errors

2018-01-28 Thread Mallireddy Gangadhar Reddy
Hi ,

I have written a simple yaml file to install httpd package

--- 
hosts: all
tasks: 
  yum: "name=httpd state=installed"




i checked the syntax at http://www.yamllint.com/ , and it looks good. But 
when i run it in the system it throws errors

[root@appserver ~]# ansible-playbook Play_Tomcat.yml 
ERROR! playbooks must be a list of plays

The error appears to have been in '/root/Play_Tomcat.yml': line 2, column 
1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
hosts: all
^ here



Can you please let me know what is missing , i am able to run the ad-hoc 
commands...


Regards
Gangadhar M

-- 
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/5e354b35-0351-46f8-9440-f55976fa931a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] service module fails to start nginx usig a docker connection

2018-01-28 Thread Ruben Decrop
I am using ansible to manage a group of Docker containers, using 
docker_connection.

All goes well unitl I am instructing nginx to be started in the container 
using this snippet

- name: ensure nginx started
 service: 
name: nginx 
state: started

No error message is given but nginx is not started in the container
If I replace it by 

- name: ensure nginx started
 command: service nginx start 

it gives a warning to consider using the service module, but it works.   Am 
I doing somethnig wrong, or is this a kind of weird bug? 

-- 
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/ccd7108e-5098-4ee6-bf96-86a861b8d343%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.