I think I am getting closer thanks to the help from Peter. The problem that I am stuck on is how to have multiple cmd.wait_script. When I try the sls shown below only the second cmd.wait_script is actually used, the other one disappears. Clearly I am not grasping the syntax of an sls file adequately, but the many variations that I have attempted are worse. Does anyone have a suggestion? Also, is there a better way to deal with the /tmp/*.bak files that I force to be created?
$ cat users.sls
/tmp/passwd.bak:
file.copy:
- source: /etc/passwd
- force: true
cmd.wait_script:
- source: salt://users/chuid.sh
- name: export PASSWD_BACKUP=/tmp/passwd.bak && sh /var/cache/salt/minion/scripts/chuid.sh {{ username }} {{ username }}
- watch:
- user: {{ username }}
cmd.wait_script:
- source: salt://users/chgid.sh
- name: export GROUP_BACKUP=/tmp/group.bak && sh /var/cache/salt/minion/scripts/chgid.sh {{ username }} {{ username }}
- watch:
- group: {{ username }}
{% endfor %}
Thanks in advance - Marc