Running command using Ansible

Hi, 

How can I run this command using ansible or by creating a playbook. 

bash <(curl -Ss https://my-netdata.io/kickstart.sh) all


Thanks for your help. 

Tapobal 
  • post-author-pic
    Ali M
    11-21-2018

    Hi A J,


    You could use the shell module to execute that command:

    ansible all -m shell -a "curl -Ss https://my-netdata.io/kickstart.sh"

    For playbook, feel free to have a look at the samples provided for the shell module:


    https://docs.ansible.com/ansible/latest/modules/shell_module.html#shell-module




  • post-author-pic
    A J
    11-21-2018

    I already tried that solution, it did not work. It throws timeout. 

  • post-author-pic
    Piotr N
    11-21-2018

    Maybe this playbook helps: 

    ---
    - hosts: all
    become: True
    tasks:
    - name: Get script
    get_url:
    url: https://my-netdata.io/kickstart.sh
    dest: /tmp/kickstart.sh
    mode: 0755

    - name: Exec kickstart.sh
    script: /tmp/kickstart.sh --non-interactive all
    args:
    executable: bash


  • post-author-pic
    Ali M
    11-21-2018

    Hi A J,


    I was able to successfully download that shell script using the command provided in my earlier comment. 

    You are getting a time out error, which is not related to the syntax of the ansible command but rather with the ansible control machine's connectivity to the hostname my-netdata.io  or to one of the inventory machines. So please check for issues around both.

    Additionally, I would recommend you to paste the error here which  is being returned to you, so that we can try helping you further.

Looking For Team Training?

Learn More