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

    Ansible Custom Facts

    IT Discussion
    ansible linux custom facts
    3
    10
    3.0k
    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 stacksofplates

      So I want to install our backup agent on our servers but not on our workstations. I haven't found a good fact out of the box that you can use to separate the two. If I was using Ansible push (which I might switch to later on once tower is released for free) it wouldn't be an issue, but with ansible-pull you're limited to the facts on your localhost. So to add a custom fact you just need to add a script in /etc/ansible/facts.d that ends with .fact and spits out some JSON. So here's what I did in /etc/ansible/facts.d/system_type.fact:

      #!/bin/bash
      
      cat <<EOF
      
      {
          "label" : "workstation"
      }
      EOF
      

      These facts are lumped together under the ansible_local group. So to call this with a conditional you would use

      when:  ansible_local.system_type.label == "workstation"
      
      A 1 Reply Last reply Reply Quote 2
      • stacksofplatesS
        stacksofplates
        last edited by stacksofplates

        Right now I'll push this out with Ansible to the machines, but I'll add that in the template for our servers.

        1 Reply Last reply Reply Quote 0
        • A
          Alex Sage @stacksofplates
          last edited by

          @stacksofplates said in Ansible Custom Facts:

          which I might switch to later on once tower is released for free

          When is this happening?

          stacksofplatesS 1 Reply Last reply Reply Quote 0
          • stacksofplatesS
            stacksofplates @Alex Sage
            last edited by

            @aaronstuder said in Ansible Custom Facts:

            @stacksofplates said in Ansible Custom Facts:

            which I might switch to later on once tower is released for free

            When is this happening?

            Supposed to be this year.

            A 1 Reply Last reply Reply Quote 0
            • A
              Alex Sage @stacksofplates
              last edited by

              @stacksofplates So then all you pay for is support?

              DashrenderD stacksofplatesS 2 Replies Last reply Reply Quote 0
              • DashrenderD
                Dashrender @Alex Sage
                last edited by

                @aaronstuder said in Ansible Custom Facts:

                @stacksofplates So then all you pay for is support?

                LOL - you almost make it sound like it will be cheap.

                1 Reply Last reply Reply Quote 0
                • stacksofplatesS
                  stacksofplates @Alex Sage
                  last edited by

                  @aaronstuder said in Ansible Custom Facts:

                  @stacksofplates So then all you pay for is support?

                  I'm sure it will be an upstream project, because that's how everything else they have is set up. So if you want support you would get the stable version and pay 10K for 100 nodes (according to current pricing).

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    Alex Sage @stacksofplates
                    last edited by

                    @stacksofplates It's already free for 10 nodes, so what will change? Free for unlimited nodes?

                    stacksofplatesS 1 Reply Last reply Reply Quote 0
                    • stacksofplatesS
                      stacksofplates @Alex Sage
                      last edited by

                      @aaronstuder said in Ansible Custom Facts:

                      @stacksofplates It's already free for 10 nodes, so what will change? Free for unlimited nodes?

                      Yes. It will be open source. So assuming they do an upstream it would be free for whatever unless you need support.

                      1 Reply Last reply Reply Quote 0
                      • A
                        Alex Sage
                        last edited by Alex Sage

                        Trying to figure out if I should learn Ansible or Salt Stack.... hm..... Thoughts?

                        I am studying for my RHCSA... so maybe Ansible makes since?

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