Kathy L
unread,Sep 5, 2023, 8:22:11 AM9/5/23Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
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 }}"