I would like to execute the below tasks which create a user on a remote host and trigger an SMS gateway call from master/control node.
This is running from awx/(tower) where I get some of the parameters through an AWX survey.
---------------------------------------------
- name: create users
user:
name={{ user_name }}
comment={{ user_comment }}
shell=/bin/bash
home=/home/{{ user_name }}
state=present
createhome=yes
password={{ my_pass | password_hash('sha512') }}
update_password=on_create
register: user_created
- name: Expire password
shell: chage -d 0 {{ user_name }}
when: user_created.changed
- name: Sent SMS to user
uri:
url: "http://example.com/bms/soap/Messenger.asmx/HTTP_SendSms?\
customerID={{ customerID }}&\
userName={{ userName }}&\
userPassword={{ userPassword }}&\
originator={{ originator }}&\
smsText=Hostname:%20{{ ansible_hostname }}%0aIP%20Address:%20{{ ansible_ssh_host }}%0ausername:%20{{ user_name }}%0aPassword:%20{{ my_pass }}%0a%0aNOTE:User%20needs%20to%20change%20password%20upon%20first%20login&\
recipientPhone={{ phone_number }}&\
messageType=Latin&\
blink=false&\
flash=false&\
Private=false&\
defDate=20220518090503"
when: user_created.changed
-------------------------------------------------------
i gone through deligate_to, i tried adding that my code, still didn't worked.
can anyone please help me to achieve this?
Thanks