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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1c72e363-9a1c-4e3b-9768-5fae67d7b5een%40googlegroups.com.

Reply via email to