Why does upgrading through Ansible commonly considered “idempotent”?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0














I know that an idempotent function returns a result which is can be returned more than once without changing the application essentially (like adding zero to a number or multiplying that number by 1).



doing some_package_manager upgrade X -y via Ansible's state=latest + a cron schedule isn't idempotent in that sense because the result does change the application essentially; each new upgrade has new features.



So where, why and when did the notion of an "Idempotent Ansible ad-hok command/playbook" appeared?










share|improve this question























  • Think of "idempotent" more as "doesn't hurt to do it more than once". For example, HTTP GET requests are (supposed to be) idempotent, reloading a page does not change the server's state.
    – Ulrich Schwarz
    Dec 27 '18 at 11:55










  • That’s not what idempotence is. See the Wikipedia entry on the topic. (This is in response to the question, not Ulrich’s comment.)
    – Stephen Kitt
    Dec 27 '18 at 11:55











  • Also, Ansible playbooks aren’t necessarily idempotent.
    – Stephen Kitt
    Dec 27 '18 at 11:57










  • Edited per comments.
    – JohnDoea
    Dec 27 '18 at 12:00











  • I down-voted because John has already been told Dec 19, 2018 that: Idempotence means that a playbook "can be applied multiple times without changing the result beyond the initial application". Best practice is to run a playbook twice. During the first run a playbook performs all changes. During the second run no changes should be reported.
    – Vladimir Botka
    Dec 27 '18 at 12:09
















0














I know that an idempotent function returns a result which is can be returned more than once without changing the application essentially (like adding zero to a number or multiplying that number by 1).



doing some_package_manager upgrade X -y via Ansible's state=latest + a cron schedule isn't idempotent in that sense because the result does change the application essentially; each new upgrade has new features.



So where, why and when did the notion of an "Idempotent Ansible ad-hok command/playbook" appeared?










share|improve this question























  • Think of "idempotent" more as "doesn't hurt to do it more than once". For example, HTTP GET requests are (supposed to be) idempotent, reloading a page does not change the server's state.
    – Ulrich Schwarz
    Dec 27 '18 at 11:55










  • That’s not what idempotence is. See the Wikipedia entry on the topic. (This is in response to the question, not Ulrich’s comment.)
    – Stephen Kitt
    Dec 27 '18 at 11:55











  • Also, Ansible playbooks aren’t necessarily idempotent.
    – Stephen Kitt
    Dec 27 '18 at 11:57










  • Edited per comments.
    – JohnDoea
    Dec 27 '18 at 12:00











  • I down-voted because John has already been told Dec 19, 2018 that: Idempotence means that a playbook "can be applied multiple times without changing the result beyond the initial application". Best practice is to run a playbook twice. During the first run a playbook performs all changes. During the second run no changes should be reported.
    – Vladimir Botka
    Dec 27 '18 at 12:09














0












0








0







I know that an idempotent function returns a result which is can be returned more than once without changing the application essentially (like adding zero to a number or multiplying that number by 1).



doing some_package_manager upgrade X -y via Ansible's state=latest + a cron schedule isn't idempotent in that sense because the result does change the application essentially; each new upgrade has new features.



So where, why and when did the notion of an "Idempotent Ansible ad-hok command/playbook" appeared?










share|improve this question















I know that an idempotent function returns a result which is can be returned more than once without changing the application essentially (like adding zero to a number or multiplying that number by 1).



doing some_package_manager upgrade X -y via Ansible's state=latest + a cron schedule isn't idempotent in that sense because the result does change the application essentially; each new upgrade has new features.



So where, why and when did the notion of an "Idempotent Ansible ad-hok command/playbook" appeared?







package-management upgrade ansible architecture software-updates






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 27 '18 at 12:00







JohnDoea

















asked Dec 27 '18 at 11:45









JohnDoeaJohnDoea

1171132




1171132











  • Think of "idempotent" more as "doesn't hurt to do it more than once". For example, HTTP GET requests are (supposed to be) idempotent, reloading a page does not change the server's state.
    – Ulrich Schwarz
    Dec 27 '18 at 11:55










  • That’s not what idempotence is. See the Wikipedia entry on the topic. (This is in response to the question, not Ulrich’s comment.)
    – Stephen Kitt
    Dec 27 '18 at 11:55











  • Also, Ansible playbooks aren’t necessarily idempotent.
    – Stephen Kitt
    Dec 27 '18 at 11:57










  • Edited per comments.
    – JohnDoea
    Dec 27 '18 at 12:00











  • I down-voted because John has already been told Dec 19, 2018 that: Idempotence means that a playbook "can be applied multiple times without changing the result beyond the initial application". Best practice is to run a playbook twice. During the first run a playbook performs all changes. During the second run no changes should be reported.
    – Vladimir Botka
    Dec 27 '18 at 12:09

















  • Think of "idempotent" more as "doesn't hurt to do it more than once". For example, HTTP GET requests are (supposed to be) idempotent, reloading a page does not change the server's state.
    – Ulrich Schwarz
    Dec 27 '18 at 11:55










  • That’s not what idempotence is. See the Wikipedia entry on the topic. (This is in response to the question, not Ulrich’s comment.)
    – Stephen Kitt
    Dec 27 '18 at 11:55











  • Also, Ansible playbooks aren’t necessarily idempotent.
    – Stephen Kitt
    Dec 27 '18 at 11:57










  • Edited per comments.
    – JohnDoea
    Dec 27 '18 at 12:00











  • I down-voted because John has already been told Dec 19, 2018 that: Idempotence means that a playbook "can be applied multiple times without changing the result beyond the initial application". Best practice is to run a playbook twice. During the first run a playbook performs all changes. During the second run no changes should be reported.
    – Vladimir Botka
    Dec 27 '18 at 12:09
















Think of "idempotent" more as "doesn't hurt to do it more than once". For example, HTTP GET requests are (supposed to be) idempotent, reloading a page does not change the server's state.
– Ulrich Schwarz
Dec 27 '18 at 11:55




Think of "idempotent" more as "doesn't hurt to do it more than once". For example, HTTP GET requests are (supposed to be) idempotent, reloading a page does not change the server's state.
– Ulrich Schwarz
Dec 27 '18 at 11:55












That’s not what idempotence is. See the Wikipedia entry on the topic. (This is in response to the question, not Ulrich’s comment.)
– Stephen Kitt
Dec 27 '18 at 11:55





That’s not what idempotence is. See the Wikipedia entry on the topic. (This is in response to the question, not Ulrich’s comment.)
– Stephen Kitt
Dec 27 '18 at 11:55













Also, Ansible playbooks aren’t necessarily idempotent.
– Stephen Kitt
Dec 27 '18 at 11:57




Also, Ansible playbooks aren’t necessarily idempotent.
– Stephen Kitt
Dec 27 '18 at 11:57












Edited per comments.
– JohnDoea
Dec 27 '18 at 12:00





Edited per comments.
– JohnDoea
Dec 27 '18 at 12:00













I down-voted because John has already been told Dec 19, 2018 that: Idempotence means that a playbook "can be applied multiple times without changing the result beyond the initial application". Best practice is to run a playbook twice. During the first run a playbook performs all changes. During the second run no changes should be reported.
– Vladimir Botka
Dec 27 '18 at 12:09





I down-voted because John has already been told Dec 19, 2018 that: Idempotence means that a playbook "can be applied multiple times without changing the result beyond the initial application". Best practice is to run a playbook twice. During the first run a playbook performs all changes. During the second run no changes should be reported.
– Vladimir Botka
Dec 27 '18 at 12:09











1 Answer
1






active

oldest

votes


















0














"Idempotence" is a property often ascribed to configuration management systems, of which Ansible is only one example. Puppet also describes itself as idempotent; like Ansible, it would be more accurate to say "quasi-idempotent", because they both offer ways to break strict idempotence.



I think your question is partly motivated by a misunderstanding about the more formal meaning of idempotence, which is a operation that will always give the same result no matter how many times you apply it.



Although adding zero or multiplying by one both satisfy the definition of idempotency, they are what we might call trivially idempotent. They are no-ops, and in general idempotence need not be a no-op.



Some examples that might help you get at the more general intuition for idempotence:



  • Dividing a number by itself.

  • Subtracting a number from itself.

  • Flattening a 3D object onto a surface: once it is flattened, flattening it more will not change its shape further.

  • Burning a log: once it is completely burned, applying more flame to it will not burn it further.

  • Using a spoon to dissolve coffee into hot water: once the coffee is dissolved, further stirring will not make it "more dissolved".

  • Telling a dog to "sit": it will have an effect the first time, but subsequent commands to sit will not produce change.

  • Copying a configuration file from one computer to another: once it is copied the first time, copying the file again will not change the destination file any further.

The last two examples get most closely at what is meant by idempotence in the context of configuration management systems. At their simplest, they are about putting the remote machine into a desired state, by either copying files or issuing commands. Once the remote is in that state it should/will have no effect to copy the files or issue the commands again.



The reason idempotence is marketed as a desirable property of configuration management systems like Ansible or Puppet is that when managing a large number of servers, it is most convenient if as many of them as possible have the same configuration as each other. To enforce uniformity, you copy over the required configuration files, set their firewalls the same way, etc. But it is desirable to be able to do this repetitively, because when running a big farm of servers you don't want to waste time figuring out which ones have deviated slightly because of some maintenance or upgrade. You just want to be able to tell all the servers at once: "adopt the preferred configuration".



It is like if you are trying to manage a roomful of dogs, and you want them all to be seated: some of them are sitting already, but others are standing. Issuing the "sit" command will not affect the ones already seated, but it will bring the whole room into the desired uniform configuration.






share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491110%2fwhy-does-upgrading-through-ansible-commonly-considered-idempotent%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    "Idempotence" is a property often ascribed to configuration management systems, of which Ansible is only one example. Puppet also describes itself as idempotent; like Ansible, it would be more accurate to say "quasi-idempotent", because they both offer ways to break strict idempotence.



    I think your question is partly motivated by a misunderstanding about the more formal meaning of idempotence, which is a operation that will always give the same result no matter how many times you apply it.



    Although adding zero or multiplying by one both satisfy the definition of idempotency, they are what we might call trivially idempotent. They are no-ops, and in general idempotence need not be a no-op.



    Some examples that might help you get at the more general intuition for idempotence:



    • Dividing a number by itself.

    • Subtracting a number from itself.

    • Flattening a 3D object onto a surface: once it is flattened, flattening it more will not change its shape further.

    • Burning a log: once it is completely burned, applying more flame to it will not burn it further.

    • Using a spoon to dissolve coffee into hot water: once the coffee is dissolved, further stirring will not make it "more dissolved".

    • Telling a dog to "sit": it will have an effect the first time, but subsequent commands to sit will not produce change.

    • Copying a configuration file from one computer to another: once it is copied the first time, copying the file again will not change the destination file any further.

    The last two examples get most closely at what is meant by idempotence in the context of configuration management systems. At their simplest, they are about putting the remote machine into a desired state, by either copying files or issuing commands. Once the remote is in that state it should/will have no effect to copy the files or issue the commands again.



    The reason idempotence is marketed as a desirable property of configuration management systems like Ansible or Puppet is that when managing a large number of servers, it is most convenient if as many of them as possible have the same configuration as each other. To enforce uniformity, you copy over the required configuration files, set their firewalls the same way, etc. But it is desirable to be able to do this repetitively, because when running a big farm of servers you don't want to waste time figuring out which ones have deviated slightly because of some maintenance or upgrade. You just want to be able to tell all the servers at once: "adopt the preferred configuration".



    It is like if you are trying to manage a roomful of dogs, and you want them all to be seated: some of them are sitting already, but others are standing. Issuing the "sit" command will not affect the ones already seated, but it will bring the whole room into the desired uniform configuration.






    share|improve this answer



























      0














      "Idempotence" is a property often ascribed to configuration management systems, of which Ansible is only one example. Puppet also describes itself as idempotent; like Ansible, it would be more accurate to say "quasi-idempotent", because they both offer ways to break strict idempotence.



      I think your question is partly motivated by a misunderstanding about the more formal meaning of idempotence, which is a operation that will always give the same result no matter how many times you apply it.



      Although adding zero or multiplying by one both satisfy the definition of idempotency, they are what we might call trivially idempotent. They are no-ops, and in general idempotence need not be a no-op.



      Some examples that might help you get at the more general intuition for idempotence:



      • Dividing a number by itself.

      • Subtracting a number from itself.

      • Flattening a 3D object onto a surface: once it is flattened, flattening it more will not change its shape further.

      • Burning a log: once it is completely burned, applying more flame to it will not burn it further.

      • Using a spoon to dissolve coffee into hot water: once the coffee is dissolved, further stirring will not make it "more dissolved".

      • Telling a dog to "sit": it will have an effect the first time, but subsequent commands to sit will not produce change.

      • Copying a configuration file from one computer to another: once it is copied the first time, copying the file again will not change the destination file any further.

      The last two examples get most closely at what is meant by idempotence in the context of configuration management systems. At their simplest, they are about putting the remote machine into a desired state, by either copying files or issuing commands. Once the remote is in that state it should/will have no effect to copy the files or issue the commands again.



      The reason idempotence is marketed as a desirable property of configuration management systems like Ansible or Puppet is that when managing a large number of servers, it is most convenient if as many of them as possible have the same configuration as each other. To enforce uniformity, you copy over the required configuration files, set their firewalls the same way, etc. But it is desirable to be able to do this repetitively, because when running a big farm of servers you don't want to waste time figuring out which ones have deviated slightly because of some maintenance or upgrade. You just want to be able to tell all the servers at once: "adopt the preferred configuration".



      It is like if you are trying to manage a roomful of dogs, and you want them all to be seated: some of them are sitting already, but others are standing. Issuing the "sit" command will not affect the ones already seated, but it will bring the whole room into the desired uniform configuration.






      share|improve this answer

























        0












        0








        0






        "Idempotence" is a property often ascribed to configuration management systems, of which Ansible is only one example. Puppet also describes itself as idempotent; like Ansible, it would be more accurate to say "quasi-idempotent", because they both offer ways to break strict idempotence.



        I think your question is partly motivated by a misunderstanding about the more formal meaning of idempotence, which is a operation that will always give the same result no matter how many times you apply it.



        Although adding zero or multiplying by one both satisfy the definition of idempotency, they are what we might call trivially idempotent. They are no-ops, and in general idempotence need not be a no-op.



        Some examples that might help you get at the more general intuition for idempotence:



        • Dividing a number by itself.

        • Subtracting a number from itself.

        • Flattening a 3D object onto a surface: once it is flattened, flattening it more will not change its shape further.

        • Burning a log: once it is completely burned, applying more flame to it will not burn it further.

        • Using a spoon to dissolve coffee into hot water: once the coffee is dissolved, further stirring will not make it "more dissolved".

        • Telling a dog to "sit": it will have an effect the first time, but subsequent commands to sit will not produce change.

        • Copying a configuration file from one computer to another: once it is copied the first time, copying the file again will not change the destination file any further.

        The last two examples get most closely at what is meant by idempotence in the context of configuration management systems. At their simplest, they are about putting the remote machine into a desired state, by either copying files or issuing commands. Once the remote is in that state it should/will have no effect to copy the files or issue the commands again.



        The reason idempotence is marketed as a desirable property of configuration management systems like Ansible or Puppet is that when managing a large number of servers, it is most convenient if as many of them as possible have the same configuration as each other. To enforce uniformity, you copy over the required configuration files, set their firewalls the same way, etc. But it is desirable to be able to do this repetitively, because when running a big farm of servers you don't want to waste time figuring out which ones have deviated slightly because of some maintenance or upgrade. You just want to be able to tell all the servers at once: "adopt the preferred configuration".



        It is like if you are trying to manage a roomful of dogs, and you want them all to be seated: some of them are sitting already, but others are standing. Issuing the "sit" command will not affect the ones already seated, but it will bring the whole room into the desired uniform configuration.






        share|improve this answer














        "Idempotence" is a property often ascribed to configuration management systems, of which Ansible is only one example. Puppet also describes itself as idempotent; like Ansible, it would be more accurate to say "quasi-idempotent", because they both offer ways to break strict idempotence.



        I think your question is partly motivated by a misunderstanding about the more formal meaning of idempotence, which is a operation that will always give the same result no matter how many times you apply it.



        Although adding zero or multiplying by one both satisfy the definition of idempotency, they are what we might call trivially idempotent. They are no-ops, and in general idempotence need not be a no-op.



        Some examples that might help you get at the more general intuition for idempotence:



        • Dividing a number by itself.

        • Subtracting a number from itself.

        • Flattening a 3D object onto a surface: once it is flattened, flattening it more will not change its shape further.

        • Burning a log: once it is completely burned, applying more flame to it will not burn it further.

        • Using a spoon to dissolve coffee into hot water: once the coffee is dissolved, further stirring will not make it "more dissolved".

        • Telling a dog to "sit": it will have an effect the first time, but subsequent commands to sit will not produce change.

        • Copying a configuration file from one computer to another: once it is copied the first time, copying the file again will not change the destination file any further.

        The last two examples get most closely at what is meant by idempotence in the context of configuration management systems. At their simplest, they are about putting the remote machine into a desired state, by either copying files or issuing commands. Once the remote is in that state it should/will have no effect to copy the files or issue the commands again.



        The reason idempotence is marketed as a desirable property of configuration management systems like Ansible or Puppet is that when managing a large number of servers, it is most convenient if as many of them as possible have the same configuration as each other. To enforce uniformity, you copy over the required configuration files, set their firewalls the same way, etc. But it is desirable to be able to do this repetitively, because when running a big farm of servers you don't want to waste time figuring out which ones have deviated slightly because of some maintenance or upgrade. You just want to be able to tell all the servers at once: "adopt the preferred configuration".



        It is like if you are trying to manage a roomful of dogs, and you want them all to be seated: some of them are sitting already, but others are standing. Issuing the "sit" command will not affect the ones already seated, but it will bring the whole room into the desired uniform configuration.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 27 '18 at 23:20

























        answered Dec 27 '18 at 19:33









        cryptarchcryptarch

        5366




        5366



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491110%2fwhy-does-upgrading-through-ansible-commonly-considered-idempotent%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown






            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay