ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Callback Provisioning with Ansible Tower

    IT Discussion
    ansible tower configuration management
    4
    9
    5.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stacksofplatesS
      stacksofplates
      last edited by

      One big advantage to Tower is the REST API. This means hosts can do an API call to Tower and have Tower run a playbook against your host. One way I use it is we create a systemd timer and service in the post install section of the kickstart config. After a system reboots it waits for a predetermined time and does an API call to run the provisioning playbook to make sure the system is in compliance. This can be done at predetermined intervals also, like every 15 minutes.

      To enable this all you have to do is enable callback provisioning in your job template:

      0_1499822425323_callback.png

      It gives you the URL and the key. Tower ships with a script for the API call, but you can just use curl also. Here's an example:

      curl --data "host_config_key=d13a7b6e08e84c7d8f412b9754400a00" https://tower.pa.jhbcomputers.com/api/v1/job_templates/26/callback/ -k
      

      This will tell Tower to run job template 26 and add a limit of this host.

      Since the job is run from Tower, it's added to the system reporting and any job template options are applied also (like auto SCM updates).

      0_1499823061339_job.png

      Emad RE jmooreJ 2 Replies Last reply Reply Quote 5
      • Emad RE
        Emad R @stacksofplates
        last edited by

        @stacksofplates

        Keeps giving me this
        {"msg":"No matching host could be found!"}
        any clues

        travisdh1T stacksofplatesS 2 Replies Last reply Reply Quote 0
        • travisdh1T
          travisdh1 @Emad R
          last edited by

          @Emad-R said in Callback Provisioning with Ansible Tower:

          @stacksofplates

          Keeps giving me this
          {"msg":"No matching host could be found!"}
          any clues

          Not knowing much, I'd guess that you need to use the host_config_key of your host instead of his example.

          Emad RE 1 Reply Last reply Reply Quote 0
          • Emad RE
            Emad R @travisdh1
            last edited by

            @travisdh1

            no the host key is accurate , if i changed it it gives another result saying permission denied

            1 Reply Last reply Reply Quote 0
            • stacksofplatesS
              stacksofplates @Emad R
              last edited by

              @Emad-R said in Callback Provisioning with Ansible Tower:

              @stacksofplates

              Keeps giving me this
              {"msg":"No matching host could be found!"}
              any clues

              Is the host in your inventory? That's usually what you get if it's not.

              Emad RE 1 Reply Last reply Reply Quote 0
              • Emad RE
                Emad R @stacksofplates
                last edited by

                @stacksofplates

                It is, i added it even by IP and by hostname.

                I wonder if this is related that i am running AWX in docker mode and if that is affecting it.

                Btw do you know to install AWX without docker ?

                stacksofplatesS 1 Reply Last reply Reply Quote 0
                • stacksofplatesS
                  stacksofplates @Emad R
                  last edited by

                  @Emad-R said in Callback Provisioning with Ansible Tower:

                  @stacksofplates

                  It is, i added it even by IP and by hostname.

                  I wonder if this is related that i am running AWX in docker mode and if that is affecting it.

                  Btw do you know to install AWX without docker ?

                  Do you have PTR records set up for the host? I'm not sure if Tower looks at the IP or reverse name for the caller.

                  No it's Docker only. Only Tower has a non container based install.

                  Emad RE 1 Reply Last reply Reply Quote 1
                  • Emad RE
                    Emad R @stacksofplates
                    last edited by

                    @stacksofplates

                    well i did put it in
                    /etc/hosts

                    but will try giving it PTR record

                    1 Reply Last reply Reply Quote 0
                    • jmooreJ
                      jmoore @stacksofplates
                      last edited by

                      @stacksofplates Thanks, good info. Im learning ansible now.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post