Tell me about your ansible automations.

1 reply
jim.coyne
11 posts

root@myantsle:~/antlet # ansible-playbook -i hosts antlet_create.yml -M ./ --extra-vars '{"remote_port":"22011", "antlet_num":"11","container_name":"MyContainer1",}'

PLAY [127.0.0.1] ************************************************************************************************************************************

TASK [Set facts (default to t2.small)] **************************************************************************************************************

ok: [127.0.0.1]

TASK [Create antlet] ********************************************************************************************************************************

changed: [127.0.0.1]

TASK [Add internal IP to hosts file] ****************************************************************************************************************

ok: [127.0.0.1]

TASK [Wait for SSH to become available [VM takes a few minutes]] ************************************************************************************

ok: [127.0.0.1]

PLAY [VM] *******************************************************************************************************************************************

TASK [Ensure .ssh directory exists] *****************************************************************************************************************

changed: [10.1.1.11]

TASK [Copy public key to remote server] *************************************************************************************************************

changed: [10.1.1.11]

TASK [Add public key to authorized keys] ************************************************************************************************************

changed: [10.1.1.11]

TASK [Disable password authentication] **************************************************************************************************************

changed: [10.1.1.11]

TASK [Restart sshd] *********************************************************************************************************************************

changed: [10.1.1.11]

PLAY RECAP ******************************************************************************************************************************************

10.1.1.11                  : ok=5    changed=5    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

127.0.0.1                  : ok=4    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

root@myantsle:~/antlet # ansible-playbook -i hosts antlet_stop.yml -M ./ --extra-vars '{"remote_port":"22011", "antlet_num":"11","container_name":"MyContainer1",}'

PLAY [localhost] ************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************

ok: [localhost]

TASK [set facts] ************************************************************************************************************************************

ok: [localhost]

TASK [Stop the antlet] ******************************************************************************************************************************

changed: [localhost]

TASK [Show result] **********************************************************************************************************************************

ok: [localhost] => {

    "result": {

        "changed": true,

        "failed": false,

        "meta": {

            "message": "Force-stopping MyContainer1 ... ",

            "success": true

        }

    }

}

PLAY RECAP ******************************************************************************************************************************************

localhost                  : ok=4    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

root@myantsle:~/antlet # ansible-playbook -i hosts antlet_delete.yml -M ./ --extra-vars '{"remote_port":"22011", "antlet_num":"11","container_name":"MyContainer1",}' 

PLAY [localhost] ************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************

ok: [localhost]

TASK [set facts] ************************************************************************************************************************************

ok: [localhost]

TASK [Manage the antlet] ****************************************************************************************************************************

changed: [localhost]

TASK [Show result] **********************************************************************************************************************************

ok: [localhost] => {

    "result": {

        "changed": true,

        "failed": false,

        "meta": {

            "status": "deleted"

        }

    }

}

PLAY RECAP ******************************************************************************************************************************************

localhost                  : ok=4    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Antsle TeamStaff
32 posts

Thanks for sharing, Jim. For anyone building on this: antMan's REST API is the same on antMan 4, so automations like these carry over.

— Antsle Team

Log in to reply. New here? It takes a minute.