[ansible-project] Need Help in Ansible regex

2020-01-23 Thread Rakesh Parida
Hi all, I have a rpm whcich i have added in a list. I want to make it dynamic i.e when the version of rpm changes playbook should handle it. I have build a logic but the playbook skips the task where i have mentioned the regex. Kindly help me . - hosts: localhost tasks: - name: Create a

Re: [ansible-project] Printing only stdout_lines with command + with_items

2020-01-23 Thread Vladimir Botka
On Thu, 23 Jan 2020 16:03:36 -0800 (PST) Nicholas Yue wrote: > - debug: msg="{{ item.stdout_lines }}" > with_items: "{{ out.results }}" > > I am unable to print out just the output results in stdout_lines, it > prints out other information which I'd like to suppress Use 'loop_control'

[ansible-project] can someone please explain about "undefined" error

2020-01-23 Thread Work-Hard
Hello Guys, can someone please explain about "undefined" error Task - name: reboot if required win_reboot: when: update_count.reboot_required TASK [reboot if required]

Re: [ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Work-Hard
*Thank you, it worked* On Thursday, January 23, 2020 at 12:24:04 PM UTC-8, Jordan Borean wrote: > > Then finally for your last message, I've already told you in > https://groups.google.com/forum/#!topic/ansible-project/ME6fY1n7SCA why > it's failing the reboot check. > > Firstly > >1. The

[ansible-project] Re: Playbook is stuck, is it bug ?

2020-01-23 Thread Work-Hard
it took half an hour to run it and it's working normally now. Was it a BUG? On Thursday, January 23, 2020 at 4:33:06 PM UTC-8, Work-Hard wrote: > > *Hello guys,* > *My playbook seems to be stuck for 5 mins for 1 server. Is it bug ?* > tasks: >- name: Search and download Windows updates

[ansible-project] Playbook is stuck, is it bug ?

2020-01-23 Thread Work-Hard
*Hello guys,* *My playbook seems to be stuck for 5 mins for 1 server. Is it bug ?* tasks: - name: Search and download Windows updates without installing them win_updates: category_names: - SecurityUpdates - CriticalUpdates - UpdateRollups -

[ansible-project] Printing only stdout_lines with command + with_items

2020-01-23 Thread Nicholas Yue
Hi, I have the following ansible script $ cat generated-head-node.yaml - hosts: all tasks: - name: Run multiple commands command: "{{item}}" with_items: - pwd - ls register: out - debug: msg="{{ item.stdout_lines }}" with_items: "{{ out.results }}" I am

[ansible-project] Re: Any updates on this, please help on my POST? https://groups.google.com/forum/#!topic/ansible-project/vVYN7qsRn7U

2020-01-23 Thread Nick Schendel
Creating a second post hours after your first simply pointing back at it might not be the best way to get help. Just for future reference. On Thursday, January 23, 2020 at 1:45:06 PM UTC-6, Work-Hard wrote: > > Any updates on this, please help on my POST? >

Re: [ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Jordan Borean
Then finally for your last message, I've already told you in https://groups.google.com/forum/#!topic/ansible-project/ME6fY1n7SCA why it's failing the reboot check. Firstly 1. The reboot option in win_updates is 'reboot: yes', not 'win_reboot: yes', you would know that if you had read

Re: [ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Jordan Borean
The filtered message says it's filtered due to category_names, here are the categories you've applied in one of your tasks - Upgrades - Security Updates When you omit the category_names here are the categories it uses by default (as per the docs) - CriticalUpdates (same as "Critical

Re: [ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Nick Schendel
Based on that message it appears that a reboot is requried before you can install the patches. The win_updates module is not going to reboot the host after changes if it doesnt make any changes. Reboot the host manually, then try running again and I bet it goes. Otherwise you could probably

Re: [ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Work Email
I have tried multiple machines to download the updates but it's not working. *Playbook* * tasks:* * - name: Search and download Windows updates without installing them* * win_updates:* * state: downloaded* * win_reboot: true* *Throwing error - * fatal:

Re: [ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Dick Visser
since it works for other hosts, the problem is related to that specific host, not ansible. There may be many reasons why it doesn't work. Since ansible is just an automation tool, best to try an troubleshoot things manually on that host. On Thu, 23 Jan 2020 at 18:46, Work Email wrote: > *KB

[ansible-project] Any updates on this, please help on my POST? https://groups.google.com/forum/#!topic/ansible-project/vVYN7qsRn7U

2020-01-23 Thread Work Email
Any updates on this, please help on my POST? https://groups.google.com/forum/#!topic/ansible-project/vVYN7qsRn7U -- 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

Re: [ansible-project] Filtering a complex list of dictionaries into another list of dictionaries in an efficient way

2020-01-23 Thread Vladimir Botka
On Thu, 23 Jan 2020 10:54:52 -0800 (PST) jean-christophe manciot wrote: > loop: "{{ list| > selectattr('key3', 'regex', 'regex1|regex2|regex3')| > list }}" > [...] > For instance, if I need to add another constraint like another attribute > must match

Re: [ansible-project] How to fix this ssh-keyscan problem in my playbook?

2020-01-23 Thread RobertF
Racke, thank you very much. Changing 'command' to 'shell' fixed the problem. One follow-up... I thought ssh-keyscan *was* fetching the SSH key file from the server. Was I mistaken? What technique were you thinking of? Thanks again! On Wednesday, January 22, 2020 at 10:32:04 PM UTC-8,

Re: [ansible-project] Filtering a complex list of dictionaries into another list of dictionaries in an efficient way

2020-01-23 Thread jean-christophe manciot
fantastic! :-) My real use case is little more complex: 1. there are other attributes like "key1" or similar to "list" (within top-level "list") which must be taken into account 2. the regex filter on "key3" is a little more complex (a list of logical OR) I tried to to implement

[ansible-project] Playbook is unable to install specified KB number updates but shows OK in playbook recap

2020-01-23 Thread Work Email
*KB number upgrades/ security patches are not installing?* *Playbook* tasks: - name: Install all security, critical, and rollup updates without a scheduled task win_updates: category_names: - Upgrades - SecurityUpdates whitelist: - KB4494452 -

Re: [ansible-project] How do I include another playbook in current playbook?

2020-01-23 Thread alicia
You cannot import a playbook anywhere inside a play - importing a playbook is a play of its own. If you want to run the imported playbook first, try: - name: this play runs ‘another.yml' on the hosts it defines import_playbook: another.yml - name: this play runs two roles on all hosts in

Re: [ansible-project] Problem with Conditional variable

2020-01-23 Thread Vladimir Botka
> > There are two options for that string: > > 1. qos-nested-50 will be set when bandwidth_mb is 50. > > 2. qos-nested-new-20. 20 for example will set the string to qos-nested-new- > > when bandwidth_mb is not 50. It's possible to use the 'ternary' filter. For example - set_fact:

Re: [ansible-project] Problem with Conditional variable

2020-01-23 Thread Vladimir Botka
On Thu, 23 Jan 2020 06:22:37 -0800 (PST) Yehuda Pinhas wrote: > qos_policy: "{{ 'qos-nested-' + bandwidth_mb }}" > [...] > ** > > ERROR! Syntax Error while loading YAML. did not find

Re: [ansible-project] Problem with Conditional variable

2020-01-23 Thread Stefan Hornburg (Racke)
On 1/23/20 3:22 PM, Yehuda Pinhas wrote: > *Hi!* > *I want to make the variable qos_policy set on conditional basis:* > * > * > *If bandwidth_mb == '50'* > *  then qos_policy == 'qos-nested-50'* > * > * > *else* > *  qos_policy == 'qos-nested-new-50'* > * > * > * > * > *My code is this (not

[ansible-project] Problem with Conditional variable

2020-01-23 Thread Yehuda Pinhas
*Hi!* *I want to make the variable qos_policy set on conditional basis:* *If bandwidth_mb == '50'* * then qos_policy == 'qos-nested-50'* *else* * qos_policy == 'qos-nested-new-50'* *My code is this (not working):* qos_policy: "{{ 'qos-nested-new-' + bandwidth_mb }}" qos_policy: "{{

[ansible-project] Conditional variables

2020-01-23 Thread Yehuda Pinhas
*Hi!* *I want to make the variable qos_policy set on conditional basis:* *If bandwidth_mb == '50'* * then qos_policy == 'qos-nested-'* *else* * qos_policy == 'qos-nested-new-'* *My code is this (not working):* qos_policy: "{{ 'qos-nested-new-' + bandwidth_mb }}" qos_policy: "{{

[ansible-project] Re: turn on boto debugging in Ansible (~/.boto)

2020-01-23 Thread james dupont
Hi all, using strace on the ansiballz strace -o st -s -e openat,open,readlink,stat,lstat -f python3.7 /home/mdupont/.ansible/tmp/ansible-tmp-1579783694.3938165-128929969192073/AnsiballZ_sqs_queue.py Shows 7150 openat(AT_FDCWD, "/etc/boto.cfg", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such

[ansible-project] Re: authorized_key : How to put default value or bypass it

2020-01-23 Thread Hieronymus
That's exactly what I need. I really hadn't seen that. Thanks a lot On Thursday, January 23, 2020 at 9:24:45 AM UTC+1, Hieronymus wrote: > > Hi > > I'm using the authorized_key module in my ansible user role. > As some user aren't ssh key yet, I would like that by default this key is > not

Re: [ansible-project] authorized_key : How to put default value or bypass it

2020-01-23 Thread Martin Krizek
Just skip the item when ssh_key is not available (`false` in your example): - name: "add public keys to users" authorized_key: user: '{{ item.name }}' key:'{{ item.ssh_key }}' with_items: '{{ user }}' when: item.ssh_key On Thu, Jan 23, 2020 at 9:25 AM Hieronymus

Re: [ansible-project] ignore -has no attribute

2020-01-23 Thread Martin Krizek
Use "default" filter: https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#defaulting-undefined-variables Example: - hosts: localhost gather_facts: no vars: d: key: value tasks: - debug: msg: "{{ d.missing_attr | default('default_value') }}" On

[ansible-project] ignore -has no attribute

2020-01-23 Thread Jegan A
Hello Team, I am parsing register value using debug and using when condition to print particular matching value. While doing that am getting below error. some of the register value doesn't have "volume_attachments" variable due to that the when condition is failing. I want to ignore this

Re: [ansible-project] Encrypted Password in Playbook

2020-01-23 Thread Srinivas Naram
Suggestions please. On Wed, Jan 22, 2020 at 9:43 AM Srinivas Naram wrote: > Any suggestions would be greatly appreciated. > > On Tue, Jan 21, 2020 at 8:05 PM Srinivas Naram > wrote: > >> Hello Vladimir >> >> I have followed exactly same steps mentioned above and I see different >> errors now.

[ansible-project] authorized_key : How to put default value or bypass it

2020-01-23 Thread Hieronymus
Hi I'm using the authorized_key module in my ansible user role. As some user aren't ssh key yet, I would like that by default this key is not created and the task escaped. I've seen that the key string is required by this module. Is means that I cannot put a false default value? Here's my main

Re: [ansible-project] Re: The List manipulation doesnt work

2020-01-23 Thread Vladimir Botka
On Wed, 22 Jan 2020 21:58:14 -0800 (PST) Rakesh Parida wrote: > > - hosts: localhost > > tasks: > > - name: Create a list > > set_fact: > > some_value: > > - avenger > > - mk11 > > - witcher > > - gow > > -