[ansible-project] shell script gives different output when invoked using Ansible shell module.

2019-09-03 Thread Mohtashim S
I have check.sh script that I wish to run on the target nodes: cat check.sh str=`echo $1 | sed -e 's#[\][\]n# #g'` echo $str>check.row It is suppose to replace \\n with a single white space from the argument and save it in check.row file. When I run it manually on the target server i get

Re: [ansible-project] Requires Help ,using Python for accessing dictionary values from yaml file

2019-09-03 Thread Zolvaring
Hm okay I'm not sure that would work, but gojng back to your original example, have you tried passing the yaml file like this when you run the playbook? "--extra-vars=@your_yaml_file.yml" Reading I think that should work the same as running it "with_vars" -- You received this message because

[ansible-project] Looking For Advice On Convincing My Boss To Implement Ansible

2019-09-03 Thread Chrono 7
Hello all, I'm looking for some advice on "selling" Ansible to my boss, and I figured this would be a good place to bring this up. I'm currently working at an MSP and would like to implement Ansible to help with system preps. Particularly for workstations prior to their deployment onsite.

[ansible-project] Looking For Some Advice On Convincing My Boss To Implement Ansible

2019-09-03 Thread Chrono 7
Hello all, I'm looking for some advice on "selling" Ansible to my boss, and I figured this would be a good place to bring this up. I'm currently working at an MSP and would like to implement Ansible to help with system preps. Particularly for workstations prior to their deployment

[ansible-project] Looking For Some Advice On Convincing My Boss To Implement Ansible

2019-09-03 Thread Chrono 7
Hello all, I'm looking for some advice on "selling" Ansible to my boss, and I figured this would be a good place to bring this up. I'm currently working at an MSP and would like to implement Ansible to help with system preps. Particularly for workstations prior to their deployment onsite.

Re: [ansible-project] Temporarily disable Ansible from running on a host for 1 hour

2019-09-03 Thread Karl Auer
Put a check at the top of every script for a particular file; if the file is there, stop. On Wed, Sep 4, 2019 at 9:56 AM Nima V wrote: > I have Ansible running regularly via Jenkins. There are times where I want > to prevent a host from running ansible temporarily. What is the best way to >

[ansible-project] Temporarily disable Ansible from running on a host for 1 hour

2019-09-03 Thread Nima V
I have Ansible running regularly via Jenkins. There are times where I want to prevent a host from running ansible temporarily. What is the best way to temporarily disable Ansible so that it does not run when Jenkins runs it. -- You received this message because you are subscribed to the Google

Re: [ansible-project] open firewall for http traffic SLES 15

2019-09-03 Thread Keith Mills
I see this issue: systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2019-09-03 19:55:35 UTC; 1min 27s ago

Re: [ansible-project] open firewall for http traffic SLES 15

2019-09-03 Thread Dick Visser
OK something else is off then. I've just tried the same playbook on a vanilla SLES15 and after enabling and starting firewalld it works straight away without errors. Can you check if you have the correct package installed. It should look like this: sles15:/etc/zypp/repos.d # zypper info

Re: [ansible-project] open firewall for http traffic SLES 15

2019-09-03 Thread Keith Mills
Hello Dick, I ran that command and received this error: Collecting firewall WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read

Re: [ansible-project] open firewall for http traffic SLES 15

2019-09-03 Thread Dick Visser
On Tue, 3 Sep 2019 at 20:43, Keith Mills wrote: > > Hello All, > > I need to open firewall for http traffic for SLES 15 and I'm running into an > error! > > Here is what I have: > > - name: open firewall for http traffic > firewalld: > service: http > permanent: true > immediate:

[ansible-project] open firewall for http traffic SLES 15

2019-09-03 Thread Keith Mills
Hello All, I need to open firewall for http traffic for SLES 15 and I'm running into an error! Here is what I have: - name: open firewall for http traffic firewalld: service: http permanent: true immediate: true state: enabled when: (ansible_distribution|lower ==

[ansible-project] Re: Ansible and Azure

2019-09-03 Thread Lucas Chies
Hi @Wawrzek, Yes, they need be in a RG. But in my case the VM will be in one RG and the vNet already existing in another RG. But I achieve this using this : - name: Create Azure VM hosts: localhost connection: local vars: resource_group_vnet: rgname vnet_name: vnetname subnet_name: subnetname

[ansible-project] Re: Thoughts on Dynamic Variables

2019-09-03 Thread Cade Lambert
Awesome, thanks for the responses. This definitely looks like a more logical, thoughtful approach than cramming a bunch of if-else statements into a single line. I'll take these back and try reworking my vars file. Thanks again. -- You received this message because you are subscribed to

Re: [ansible-project] Re: Thoughts on Dynamic Variables

2019-09-03 Thread Dan Linder
Dang! @Karl Auer beat me to this example. :) Depending on your needs and comfort level, here are two examples with sample output. The first "userlistA" is closer to your original example and has each list with a name that is not consistent with the server_type variable. That leads to the

Re: [ansible-project] Ansible and Azure

2019-09-03 Thread Wawrzek Niewodniczanski
On Tue, 3 Sep 2019 at 15:57, Lucas Chies wrote: > > Hello guys, > I've a doubt ... I've a ansible script that create an windows VM on Azure, > but I already have the vnet created in and hosted in another Resource Group. > I don't know how can I create my script to put this VM in the created

Re: [ansible-project] Ansible - create a list from variable

2019-09-03 Thread Karl Auer
http://www.mydailytutorials.com/how-to-split-strings-and-join-them-in-a%E2%80%8Bnsibl%E2%80%8Be/ If your IP addresses are separated only by commas, and the comma-delimited strings contain only IP addresses, split() will do the job nicely. If there are things other than IP addresses in the input

Re: [ansible-project] Requires Help ,using Python for accessing dictionary values from yaml file

2019-09-03 Thread Pawan Kumar
Thanks Zolvaring , Took input from the file & now output is coming in string format with following command --- Now , Requires formatting of the output to a list . "ansible-playbook test.yml -e INV_FILE=latest123.yaml" test.yml --- - hosts: 127.0.0.1 connection: local tasks: -

[ansible-project] Ansible and Azure

2019-09-03 Thread Lucas Chies
Hello guys, I've a doubt ... I've a ansible script that create an windows VM on Azure, but I already have the vnet created in and hosted in another Resource Group. I don't know how can I create my script to put this VM in the created vNet. I tried to put this: virtual_network_name:

[ansible-project] Ansible - create a list from variable

2019-09-03 Thread TheSmiths
Hi, I would like to create a list from parsing a variable that contains multiple ips separated by a comma. The variable: *ips_input: ",1.1.1.1/32,2.2.2.2/32,3.3.3.3/32"* every item in the list should contain ip/mask. the expected result: *ips_input_parsed: [* * {* * single_ip:

Re: [ansible-project] Re: Thoughts on Dynamic Variables

2019-09-03 Thread Karl Auer
You could use set_fact: stanzas instead, with when: clauses. - set_fact: user_list: 'user1, user2, user3' when: server_type = 'db_server' Even better, use lists rather than strings. You can always turn one into the other, and lists are more flexible: - set_fact: user_list: ['user1',

Re: [ansible-project] Re: Thoughts on Dynamic Variables

2019-09-03 Thread Stefan Hornburg (Racke)
On 9/3/19 3:28 PM, Cade Lambert wrote: > The problem I come across is I'll need logic to decide on the content of a > variable and that logic will turn into a long > string.  For example, when determining which users to add to a system, we > might have a variable like: > > user_list: "{{

[ansible-project] Re: Thoughts on Dynamic Variables

2019-09-03 Thread Cade Lambert
The problem I come across is I'll need logic to decide on the content of a variable and that logic will turn into a long string. For example, when determining which users to add to a system, we might have a variable like: user_list: "{{ 'user1,user2,user3' if server_type=db_server else

[ansible-project] How to collect output of SQL query in an Ansible Array

2019-09-03 Thread Mohtashim S
I wish to collect the results of SQL query so that every database column is registered with a variable / array. Thus, I should be able to get the values returned by three database columns viz destip,filedets,mynum in three variables or an array / list in the same or a different play. Below