Re: [ansible-project] Ansible nested loop using index.

2018-09-27 Thread Lionel H
Replying to my-self, I managed somehow to make some progress, but now the issue is that it merge the results like the following: Given the following config: chains_config: 1: foo: bar configs: - type: bridged version: 0.2 2: foo: baz

Re: [ansible-project] Ansible nested loop using index.

2018-09-27 Thread Lionel H
Hi matt, Thanks for your reply ! That's already a good example, But I need somehow also to retrieve the index which is the chain number. Let's simplify and say we only have one type of deployment (routed or bridged): chains_config: 1: foo: bar configs: - type:

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Hi Brian, i have defined like this:- - name: Reloading Service on {{ansible_fqdn}} service: name: "{{ item }}" state: reloaded with_items: "{{ servicename.split(',') | ternary((notdefined|default('')).split(','),[]) }}" fatal: [node1]: FAILED! => msg: '''list object'' has no attr

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
On Thursday, September 27, 2018 at 10:57:15 PM UTC+5:30, Kunalsing Thakur wrote: > > if i did not pass servicename while running ansible-playbook it will skipp > the service task > and if i pass servicename the service will reloaded and check whether > service is running or not. > > > On Thurs

[ansible-project] Re: Ansible Python Module Error.

2018-09-27 Thread Saurabh
Issue is that, I want to get /usr/lib/python2.7/site-packages/ansible path. if i mention in ansible python module code this line os.path.dirname(os.path.abspath(os.path.realpath(ansible.__file__))). It's not giving me actual path but it's giving me /tmp/* path example ( */tmp/ansible_29S4ql/an

[ansible-project] Ansible Support for IBM AIX Platform

2018-09-27 Thread Sairam Krishna Lakkoju
Hey, Looking for pointers if ansible has support for AIX platform -- 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

[ansible-project] Ansible 2.5.10 is available

2018-09-27 Thread mattdavi
Hi all- we're happy to announce that the general release of Ansible 2.5.10 is now available! How do you get it? -- $ pip install ansible==2.5.10 --user The tar.gz of the release can be found here: https://releases.ansible.co

Re: [ansible-project] One server is slow to respond to ansible (but does) gather_facts

2018-09-27 Thread Brian Coca
You can use ANSIBLE_DEBUG=1 and check the target's syslog to see which commands are run and how long till 'next command', other than that is is just debugging the setup module while executing it -- -- Brian Coca -- You received this message because you are subscribed to the Google G

Re: [ansible-project] One server is slow to respond to ansible (but does) gather_facts

2018-09-27 Thread John Harmon
ansible myserver -m setup -a 'gather_subset=hardware' is definitely the culprit. Do you know of any way to break down the hardware subset to further narrow this down? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this

Re: [ansible-project] Re: cant execute bashfile using ansible

2018-09-27 Thread Jordan Borean
2 things; 1. That's a bash script and not a batch file, simply changing the extension from .sh to .bat will not work 2. Processes spawned in WinRM are killed once the parent process exist 1 is either you copied the wrong script or are using the wrong file, I can't help you there. 2 can be overc

[ansible-project] Re: Why is ConfigureRemotingForAnsible.ps1 not suitable for production?

2018-09-27 Thread Jordan Borean
Because it does a few things like enabling Basic auth and uses self signed certificates and usually globally allows WinRM traffic through. In a normal production environment you shouldn't be using Basic auth, using a CA signed certificate and only allow WinRM traffic on the network profile you w

Re: [ansible-project] One server is slow to respond to ansible (but does) gather_facts

2018-09-27 Thread Brian Coca
You can use the 'subset' option in fact gathering to narrow down what is being soo slow on that machine (likely culprits are hardware or network), this often is a symptom of some problem with the server being slow or unresponsive to some device query. -- -- Brian Coca -- You received t

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
if i did not pass servicename while running ansible-playbook it will skipp the service task and if i pass servicename the service will reloaded and check whether service is running or not. On Thursday, September 27, 2018 at 10:46:55 PM UTC+5:30, Kunalsing Thakur wrote: > > Like this. > - name:

Re: [ansible-project] One server is slow to respond to ansible (but does) gather_facts

2018-09-27 Thread John Harmon
On Wednesday, September 26, 2018 at 5:14:40 PM UTC-6, Steve R wrote: > > Is normal ssh to the server slow or only with Ansible? > > Normal SSH to the server is quick and responsive. If I ssh from the ansible server it is even quicker than from my current location directly to the server (The ans

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Like this. - name: Reloading Service on {{ansible_fqdn}} service: name: "{{ item }}" state: reloaded with_items: "{{ (notdefined is defined)|ternary((notdefined|default('')).split(','),[]) }}" But i don't see servicename there. Can you just write one line of with_items so that i can

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Brian Coca
just substitute for notdefined -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To p

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Can you help me On Thu, 27 Sep 2018, 19:49 Kunalsing Thakur, wrote: > where i can define servicename in last condition > > On Thursday, September 27, 2018 at 7:31:02 PM UTC+5:30, Brian Coca wrote: >> >> You are not using |default correctly, the split needs a defined >> variable to work on: >> >>

Re: [ansible-project] Ansible Python Module Error.

2018-09-27 Thread Ankit Vashistha
What is the issue then? On Thu, Sep 27, 2018, 4:22 PM Saurabh wrote: > Hi All, > > if i > give os.path.dirname(os.path.abspath(os.path.realpath(ansible.__file__))) > command in python terminal will give > me "/usr/lib/python2.7/site-packages/ansible" > > but if same command i write in own ansib

[ansible-project] Has anybody succesfully used the gcp_compute plugin with auth_kind: machineaccount?

2018-09-27 Thread Mpampis Mpigkonias
There is some lack of documentation when it comes on using the gcp_compute plugin a different auth_kind other thatn serviceaccount. My yml is this: plugin: gcp_compute > projects: > - my_project > service_account_email: my_m...@gmail.com > filters: null > auth_kind: machineaccount > When I

[ansible-project] Re: Starting Stopped AWS EC2 Instances from Ansible Tower

2018-09-27 Thread Kuldip Madnani
If gather_facts is false and node is unreachable, how are you going to retrieve hostvars[item]['ec2_id'] ? Is it statically declared in your inventory file? On Thursday, September 27, 2018 at 10:29:17 AM UTC-5, John Peters wrote: > > Any clue as to how to accomplish this? > > My Ansible Tower i

[ansible-project] Starting Stopped AWS EC2 Instances from Ansible Tower

2018-09-27 Thread John Peters
Any clue as to how to accomplish this? My Ansible Tower inventory has a list of hosts in it, all in 'stopped' state. I'd like to use that inventory, assign it to a playbook, that will loop through each machine in the inventory, from the *localhost*, and issue a command to start the instance to

[ansible-project] Re: Ansible Script Execution directory change from root path to other path

2018-09-27 Thread John Peters
- name: Change the working directory to somedir/ before executing the command. shell: somescript.sh >> somelog.txt args: chdir: somedir/ Does this help? Stolen from: https://docs.ansible.com/ansible/2.5/modules/shell_module.html On Thursday, 27 September 2018 11:11:47 UTC-4, venkates

[ansible-project] Ansible Script Execution directory change from root path to other path

2018-09-27 Thread venkatesh vanigalla
How to change ansible script execution directory from /root to other fodler? -- 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...@googl

Re: [ansible-project] Ansible nested loop using index.

2018-09-27 Thread Matt Martz
What is your end goal? How do you plan to use this data, assuming you could loop the way you want? Something like the following: "{{ chains|map('extract', chains_config)|map(attribute='configs')|flatten|map(attribute='type')|flatten }}" Gives: ok: [localhost] => { "msg": [ "routed"

[ansible-project] Ansible nested loop using index.

2018-09-27 Thread Lionel H
Hi all, Hope I will find the information here :-) I need to loop over 2 lists, the first one is just a list of Integers, things get tricky here because the second list needs the input from the first list to loop over. In fact, the list is included in a dictionary where keys are integers. One

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
where i can define servicename in last condition On Thursday, September 27, 2018 at 7:31:02 PM UTC+5:30, Brian Coca wrote: > > You are not using |default correctly, the split needs a defined > variable to work on: > > with_items: {{ (servicename|default('')).split(',') }} > > That still create

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
Brian Can you just edit the playbook and show me how is going to work? On Thursday, September 27, 2018 at 7:31:02 PM UTC+5:30, Brian Coca wrote: > > You are not using |default correctly, the split needs a defined > variable to work on: > > with_items: {{ (servicename|default('')).split(',') }}

[ansible-project] Re: Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
So r u saying like this. - name: Reloading Service on {{ansible_fqdn}} service: name: "{{ item }}" state: reloaded with_items: "{{ (notdefined is defined)|ternary((notdefined|default('')).split(','),[]) }}" register: result - name: checking the service status on {{ansible_fqdn}}

Re: [ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Brian Coca
You are not using |default correctly, the split needs a defined variable to work on: with_items: {{ (servicename|default('')).split(',') }} That still creates a list with single blank item so you might want to add a defined check with_items: "{{ (notdefined is defined)|ternary((notdefined|defau

[ansible-project] Task need to be skipped by default by passing extra vars

2018-09-27 Thread Kunalsing Thakur
# SUMMARY When i want to use specific tag in playbook from role it will run all task which is defined in role. # ISSUE TYPE - Bug Report # COMPONENT NAME ansible-core # ANSIBLE VERSION ``` ansible 2.6.1 config file = /etc/ansible/playbooks/example/ansible.cfg configured mo

Re: [ansible-project] Re: cant execute bashfile using ansible

2018-09-27 Thread vowner
Hello Jordan, the attached are the batch file, which will start and stop IBM Liberty servers and deploy the war files on this. Once it got started, a process will be running in windows for liberty server. server.startup.bat _ #!/bin/sh # Licensed Materials - Property of IB

[ansible-project] Re: Error with win_ping playbook

2018-09-27 Thread Yann
Perfect, removing the environment variable has solved the problem. Thanks a lot for your help. Yann -- 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-p

[ansible-project] Why is ConfigureRemotingForAnsible.ps1 not suitable for production?

2018-09-27 Thread swinickitom
The ConfigureRemotingForAnsible.ps1 file to setup Windows hosts for Ansible is not suitable for production according to the documentation. Why is it not suitable for production and what can I tweak

[ansible-project] Re: Ansible mail module: how to attach a file with a relative path?

2018-09-27 Thread Sabrina Lautier
When there's not attachment, setting "" works fine. name: Send email mail: host: "{{ smtp_server }}" from: "{{ from_address }}" to: "{{ to_recipients }}" cc: "{{ cc_recipients }}" *attach**: ""* subject: "{{ subject }}" body: "{{ body }}" subtype: "html".. So set

[ansible-project] Re: Error with win_ping playbook

2018-09-27 Thread Jordan Borean
Fantastic that let's me know what the issue is, you are coming across this https://github.com/ansible/ansible/pull/45942. Effectively running Python 2.6 with ANSIBLE_KEEP_REMOTE_FILES is causing the issue. While the pull request I linked you solves the issue, you shouldn't be running ANSIBLE_KE

[ansible-project] Ansible Python Module Error.

2018-09-27 Thread Saurabh
Hi All, if i give os.path.dirname(os.path.abspath(os.path.realpath(ansible.__file__))) command in python terminal will give me "/usr/lib/python2.7/site-packages/ansible" but if same command i write in own ansible python module. it give this path :- */tmp/ansible_29S4ql/ansible_modlib.zip/

Re: [ansible-project] Re: cant execute bashfile using ansible

2018-09-27 Thread Jordan Borean
You never really said what the batch file actually does. Does it start a process that runs in the background or is it meant to run a short living process? -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and st

[ansible-project] Re: Error with win_ping playbook

2018-09-27 Thread Yann
# ansible -m win_ping windows -vvv /usr/lib64/python2.6/site-packages/cryptography-2.3.1-py2.6-linux-x86_64.egg/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support.

Re: [ansible-project] Re: cant execute bashfile using ansible

2018-09-27 Thread vivek mv
Hi Jordan, Any suggestions further to guide me here in this scenario..?? On Wed, 26 Sep 2018, 10:37 vivek mv, wrote: > Hello Jordan. > > Yes you are correct. Actually through ansible I already installed IBM > liberty server using installer. And here the server.startup. bat file is > the default