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 
<https://docs.ansible.com/ansible/latest/user_guide/playbooks_delegation.html>, 
i tried adding that my code, still didn't worked.


can anyone please help me to achieve this? 


Thanks

-- 
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/32e3753f-d570-4681-8da5-8b1c19ea1884n%40googlegroups.com.

Reply via email to