You have to apply it to each task. Blocks have almost no options.

Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123

On Sep 5, 2023, at 8:22 AM, Kathy L <lyonsf...@gmail.com> wrote:

We have a variable num_users_to add. I am trying to run a block of commands to 
generate users and passwords for the number of users the user has plugged in, 
using the with_sequence block.  I am getting the error message "with_sequence 
is not a valid attribute for a Block."  How to I get around this?

Code:

- name:  Block to generate x number of users & passwords
  block:
      - name: Generate user
        set_fact:
           username: "{{ lookup('ansible.builtin.password', '/dev/null', 
chars=['ascii_letters', 'digits'] length = 12 ) }}"

      - name: Generate password
        set_fact:
           passwd: "{{ lookup('ansible.builtin.password', '/dev/null', 
chars=['ascii_letters', 'digits'] length = 12 ) }}:

 with_sequence:  "count={{ num_users_to_add }}"

--
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<mailto:ansible-project+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1c72e363-9a1c-4e3b-9768-5fae67d7b5een%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/1c72e363-9a1c-4e3b-9768-5fae67d7b5een%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/3C3CB63B-6456-4720-9C58-DC5DBDD4FF51%40nist.gov.

Reply via email to