Re: [ansible-project] Setting windows host/machine name using ansible

2018-05-27 Thread David Villasmil
You can use ec2_tags. On Sun, May 27, 2018, 13:16 Ali Khawaja wrote: > Hi, > > is there a way in ansible to set the name of the windows host when we are > creating the ec2 instance or maybe change it afterwards? > > Thanks > Ali > > -- > You received this message because you

[ansible-project] Multiple conditions not working

2018-05-27 Thread Pranay Nanda
I want to run few tasks in shell if they satisfy a condition. Strangely the task runs if the second condition is satisfied even though the first one fails. name: ods shell: "/something {{state}}" when: ((ods) and (not (ansible_hostname | search("demlh*" register: sss_ods_out

[ansible-project] Re: Multiple conditions not working

2018-05-27 Thread Dan Linder
The "when" stanza performs a AND when there are multiple when conditions (http://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html#the-when-statement). Whenever I encounter a problem with 'when' I try to break it up to multiple lines so the numerous parenthesis aren't

[ansible-project] ec2 creation vs ec2 retreival: different value of registered variable

2018-05-27 Thread ali . khawaja
i have a script in which sometimes i need to create an ec2 instance and sometimes an existing ec2 instance is retrieved. on both occasions, i do some further processing on the output like the following: - name: add hosts to group add_host: name: "{{ item.id }}"

Re: [ansible-project] Re: ec2 creation vs ec2 retreival: different value of registered variable

2018-05-27 Thread ali . khawaja
i'll start a new thread. there isn't seems to be an option to modify an existing post. On Sunday, May 27, 2018 at 12:58:26 PM UTC+3, David Villasmil wrote: > > Remove all formatting please > > On Sun, May 27, 2018, 11:28 wrote: > >> what i have realized is that on ec2

[ansible-project] Setting windows host/machine name using ansible

2018-05-27 Thread Ali Khawaja
Hi, is there a way in ansible to set the name of the windows host when we are creating the ec2 instance or maybe change it afterwards? Thanks Ali -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop

Re: [ansible-project] Why does 'when' conditional test fail without jinja2 templating delimiters?

2018-05-27 Thread Darren S.
On Sat, May 26, 2018 at 11:26 AM, Kai Stian Olstad wrote: >> This playbook results in the tasks being skipped because of evaluating >> to false. The debug task shows the tests evaluating to true when using >> jinja2 templating on the compared variable. > > The

Re: [ansible-project] Re: ec2 creation vs ec2 retreival: different value of registered variable

2018-05-27 Thread David Villasmil
Remove all formatting please On Sun, May 27, 2018, 11:28 wrote: > what i have realized is that on ec2 retrieval, the output is a json > object, whereas on ec2 creation, the output is json but in a string > format. is this understanding correct? do i need to convert the

Re: [ansible-project] Ansible find module , can path parameter include regex ?

2018-05-27 Thread Saranya Nagaraj
Thank you Kai , I'll try that out. On May 25, 2018 11:43 PM, "Kai Stian Olstad" < ansible-project+l...@olstad.com> wrote: > On 25.05.2018 14:36, Saranya N wrote: > >> I'm trying to find files dit.xml under particular directories. >> >> Rather than mentioning the directories as a list like below

[ansible-project] Re: ec2 creation vs ec2 retreival: different value of registered variable

2018-05-27 Thread ali . khawaja
what i have realized is that on ec2 retrieval, the output is a json object, whereas on ec2 creation, the output is json but in a string format. is this understanding correct? do i need to convert the output to json when ec2 instance is created to retrieve the values? On Sunday, May 27, 2018

[ansible-project] win_domain: The specified argument 'InstallDNS' was not recognized

2018-05-27 Thread Ali Khawaja
Hi, i am creating a domain controller using win_domain. when i ran the script again, its failing every time on win_domain command with the following error message. TASK [Promote server as Domain Controller]

[ansible-project] Multiple plays in the same playbook resolve group variables incorrectly

2018-05-27 Thread Behrang
Source code: https://github.com/behrangsa/sample-ansible-role Background: I have three different environments: test, staging, and prod and 3 applications that I deploy to them. In staging and prod, each application have a dedicated server. In test, they all will be deployed to the same box.

[ansible-project] Re: Multiple plays in the same playbook resolve group variables incorrectly

2018-05-27 Thread Behrang
Turned out this was expected behavior. From the docs : It is ok to put systems in more than one group, for instance a server could > be both a webserver and a dbserver. If you do, note that variables will > come from all

[ansible-project] delegate_to not working

2018-05-27 Thread ousmane sanogo
Hi, i have to understand "synchronize" module with "delegate_to" i am installing corosync on 2 nodes here infos: [corosync] node_a ansible_host=192.168.122.200 node_b ansible_host=192.168.122.201 playbook.yml - name: Generates corosync key command: corosync-keygen args: creates:

Re: [ansible-project] Setting windows host/machine name using ansible

2018-05-27 Thread ali . khawaja
win_domain_user requires a domain_server parameter. i need to retrieve the server name from the newly created ec2 instance to use in this command. On Sunday, May 27, 2018 at 2:50:33 PM UTC+3, David Villasmil wrote: > > You can use ec2_tags. > > On Sun, May 27, 2018, 13:16 Ali Khawaja

[ansible-project] Re: Debug with with_items and the Task Name.

2018-05-27 Thread Pranay Nanda
Use package_status.results https://stackoverflow.com/questions/37925282/iteration-using-with-items-and-register On Monday, 28 May 2018 00:32:17 UTC+5:30, Vino B wrote: > > Hi All > > Request your help on where to put the debug statement > > Requirement 1: > If a package is missing the output

[ansible-project] Re: Debug with with_items and the Task Name.

2018-05-27 Thread Vino B
Hi Pranay, if i use the package_status.results as "as below "in my play book, and the output is as below but what we need a is clean message " Package < pakage name> Missing". *Error:* TASK [debug]

[ansible-project] Re: Multiple conditions not working

2018-05-27 Thread Dan Linder
I just noticed, if you break the when into two clauses, instead of doing "not (...)" you can do this: - name: ods shell: "/something {{state}}" when: - ods - ansible_hostname is not search("demlh*") register: sss_ods_out notify: output ods ignore_errors: yes On

[ansible-project] Re: Multiple conditions not working

2018-05-27 Thread Pranay Nanda
You're a hero! Splitting does the job. I still wonder why previous logic did not work. On Sunday, 27 May 2018 21:21:15 UTC+5:30, Pranay Nanda wrote: > > I want to run few tasks in shell if they satisfy a condition. Strangely > the task runs if the second condition is satisfied even though the

Re: [ansible-project] Re: Multiple conditions not working

2018-05-27 Thread Dan Linder
I've run into subtle and hard-to-spot logic bugs (Ansible and elsewhere) that were 'correct' but magically solved when rewritten. I agree that your syntax looks spot on, but breaking it out into multiple statements might make it easier to troubleshoot later on too. Glad it worked! On Sun, May

[ansible-project] Ansible vars precendence

2018-05-27 Thread Pranay Nanda
I have an Ansible playbook that I want to load custom variables for. I do not have access to the inventory but I wish to classify the variables by their host names which can be classified in groups. The jobs would be fired from Ansible Tower. Where should I put these variables such that they by

[ansible-project] Re: Ansible vars precendence

2018-05-27 Thread Pranay Nanda
I fixed the error in the main play - name: manage services hosts: all tasks: - include_vars: "{{playbook_dir}}/../roles/service_management/vars/s1s2grouping.yml" But now it won't read variables On Monday, 28 May 2018 00:03:22 UTC+5:30, Pranay Nanda wrote: > > I have an Ansible

[ansible-project] Debug with with_items and the Task Name.

2018-05-27 Thread Vino B
Hi All Request your help on where to put the debug statement Requirement 1: If a package is missing the output should be like "Package {{ package name }} missing" When debug is used the task name does not display instead the task is named as "debug" TASK[Check the required OS Packages