Ansible playbook fails when .ansible/tmp directory path changes











up vote
0
down vote

favorite












Essentially, what is going on here is that the user account that ansible is running under is present on both the control node, and the target client.



However, on the target client, as part of the server remediation process, one of the steps is to change where the home directory of that account lives from /home/voltron/ to /opt/home/voltron/ (No, the account can't be created using that directory on server creation sadly.)



The problem in doing this with ansible is that it "loses access" to it's working tmp directory in ~/.ansible/tmp on the target client (in this case the server t-rex). This causes the playbook to fail out on any following play with the following error message:



fatal: [t-rex]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" && echo ansible-tmp-1507231978.66-123682989430617="` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" ), exited with result 1", "unreachable": true}


Now, all I need to do is somehow tell ansible that it's working directory on the target client has changed locations during the playbook run by having it re-gather facts, but that does not seem to help. (At least the way I am doing it)



I have tried to immediately call the setup module in the play after the one that changes the location of the ansible account's (voltron) working temp directory, and it "seems" to run, but then when the next "import_playbook" statement is read, the failure described above occurs, a failure is given, and the entire thing blows up forcing me to potentially re-run a fairly long playbook. Obviously, this following run does work because ansible's facts now know that it's working directory has changed.



Anyone have any ideas on how I would inform ansible when it's working temp directory location changes? Let me know, thanks!










share|improve this question


























    up vote
    0
    down vote

    favorite












    Essentially, what is going on here is that the user account that ansible is running under is present on both the control node, and the target client.



    However, on the target client, as part of the server remediation process, one of the steps is to change where the home directory of that account lives from /home/voltron/ to /opt/home/voltron/ (No, the account can't be created using that directory on server creation sadly.)



    The problem in doing this with ansible is that it "loses access" to it's working tmp directory in ~/.ansible/tmp on the target client (in this case the server t-rex). This causes the playbook to fail out on any following play with the following error message:



    fatal: [t-rex]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" && echo ansible-tmp-1507231978.66-123682989430617="` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" ), exited with result 1", "unreachable": true}


    Now, all I need to do is somehow tell ansible that it's working directory on the target client has changed locations during the playbook run by having it re-gather facts, but that does not seem to help. (At least the way I am doing it)



    I have tried to immediately call the setup module in the play after the one that changes the location of the ansible account's (voltron) working temp directory, and it "seems" to run, but then when the next "import_playbook" statement is read, the failure described above occurs, a failure is given, and the entire thing blows up forcing me to potentially re-run a fairly long playbook. Obviously, this following run does work because ansible's facts now know that it's working directory has changed.



    Anyone have any ideas on how I would inform ansible when it's working temp directory location changes? Let me know, thanks!










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Essentially, what is going on here is that the user account that ansible is running under is present on both the control node, and the target client.



      However, on the target client, as part of the server remediation process, one of the steps is to change where the home directory of that account lives from /home/voltron/ to /opt/home/voltron/ (No, the account can't be created using that directory on server creation sadly.)



      The problem in doing this with ansible is that it "loses access" to it's working tmp directory in ~/.ansible/tmp on the target client (in this case the server t-rex). This causes the playbook to fail out on any following play with the following error message:



      fatal: [t-rex]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" && echo ansible-tmp-1507231978.66-123682989430617="` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" ), exited with result 1", "unreachable": true}


      Now, all I need to do is somehow tell ansible that it's working directory on the target client has changed locations during the playbook run by having it re-gather facts, but that does not seem to help. (At least the way I am doing it)



      I have tried to immediately call the setup module in the play after the one that changes the location of the ansible account's (voltron) working temp directory, and it "seems" to run, but then when the next "import_playbook" statement is read, the failure described above occurs, a failure is given, and the entire thing blows up forcing me to potentially re-run a fairly long playbook. Obviously, this following run does work because ansible's facts now know that it's working directory has changed.



      Anyone have any ideas on how I would inform ansible when it's working temp directory location changes? Let me know, thanks!










      share|improve this question













      Essentially, what is going on here is that the user account that ansible is running under is present on both the control node, and the target client.



      However, on the target client, as part of the server remediation process, one of the steps is to change where the home directory of that account lives from /home/voltron/ to /opt/home/voltron/ (No, the account can't be created using that directory on server creation sadly.)



      The problem in doing this with ansible is that it "loses access" to it's working tmp directory in ~/.ansible/tmp on the target client (in this case the server t-rex). This causes the playbook to fail out on any following play with the following error message:



      fatal: [t-rex]: UNREACHABLE! => {"changed": false, "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in "/tmp". Failed command was: ( umask 77 && mkdir -p "` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" && echo ansible-tmp-1507231978.66-123682989430617="` echo /home/volton/.ansible/tmp/ansible-tmp-1507231978.66-123682989430617 `" ), exited with result 1", "unreachable": true}


      Now, all I need to do is somehow tell ansible that it's working directory on the target client has changed locations during the playbook run by having it re-gather facts, but that does not seem to help. (At least the way I am doing it)



      I have tried to immediately call the setup module in the play after the one that changes the location of the ansible account's (voltron) working temp directory, and it "seems" to run, but then when the next "import_playbook" statement is read, the failure described above occurs, a failure is given, and the entire thing blows up forcing me to potentially re-run a fairly long playbook. Obviously, this following run does work because ansible's facts now know that it's working directory has changed.



      Anyone have any ideas on how I would inform ansible when it's working temp directory location changes? Let me know, thanks!







      linux ansible






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 16:03









      Viscosity

      79111




      79111






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Why not change the tmp directory ansible uses? E.g. in ansible.cfg set something like



          remote_tmp = /var/tmp/notfiddledwithduringtheplay


          which may then need to be created as part of a bootstrap process, or you could risk using some common tmp directory, or ...



          There's also a local_tmp directory in the event you're instead fiddling around with things on the local system.






          share|improve this answer





















          • So you're basically saying I should mess around with the ansible.cfg file to account for this. Could work, but am I able to specify "rollover" working tmp directories to ensure this doesn't happen? I was also hoping something from within a playbook could solve it as well.
            – Viscosity
            Mar 8 at 16:38











          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',
          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%2f429055%2fansible-playbook-fails-when-ansible-tmp-directory-path-changes%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








          up vote
          0
          down vote













          Why not change the tmp directory ansible uses? E.g. in ansible.cfg set something like



          remote_tmp = /var/tmp/notfiddledwithduringtheplay


          which may then need to be created as part of a bootstrap process, or you could risk using some common tmp directory, or ...



          There's also a local_tmp directory in the event you're instead fiddling around with things on the local system.






          share|improve this answer





















          • So you're basically saying I should mess around with the ansible.cfg file to account for this. Could work, but am I able to specify "rollover" working tmp directories to ensure this doesn't happen? I was also hoping something from within a playbook could solve it as well.
            – Viscosity
            Mar 8 at 16:38















          up vote
          0
          down vote













          Why not change the tmp directory ansible uses? E.g. in ansible.cfg set something like



          remote_tmp = /var/tmp/notfiddledwithduringtheplay


          which may then need to be created as part of a bootstrap process, or you could risk using some common tmp directory, or ...



          There's also a local_tmp directory in the event you're instead fiddling around with things on the local system.






          share|improve this answer





















          • So you're basically saying I should mess around with the ansible.cfg file to account for this. Could work, but am I able to specify "rollover" working tmp directories to ensure this doesn't happen? I was also hoping something from within a playbook could solve it as well.
            – Viscosity
            Mar 8 at 16:38













          up vote
          0
          down vote










          up vote
          0
          down vote









          Why not change the tmp directory ansible uses? E.g. in ansible.cfg set something like



          remote_tmp = /var/tmp/notfiddledwithduringtheplay


          which may then need to be created as part of a bootstrap process, or you could risk using some common tmp directory, or ...



          There's also a local_tmp directory in the event you're instead fiddling around with things on the local system.






          share|improve this answer












          Why not change the tmp directory ansible uses? E.g. in ansible.cfg set something like



          remote_tmp = /var/tmp/notfiddledwithduringtheplay


          which may then need to be created as part of a bootstrap process, or you could risk using some common tmp directory, or ...



          There's also a local_tmp directory in the event you're instead fiddling around with things on the local system.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 16:23









          thrig

          23.7k12955




          23.7k12955












          • So you're basically saying I should mess around with the ansible.cfg file to account for this. Could work, but am I able to specify "rollover" working tmp directories to ensure this doesn't happen? I was also hoping something from within a playbook could solve it as well.
            – Viscosity
            Mar 8 at 16:38


















          • So you're basically saying I should mess around with the ansible.cfg file to account for this. Could work, but am I able to specify "rollover" working tmp directories to ensure this doesn't happen? I was also hoping something from within a playbook could solve it as well.
            – Viscosity
            Mar 8 at 16:38
















          So you're basically saying I should mess around with the ansible.cfg file to account for this. Could work, but am I able to specify "rollover" working tmp directories to ensure this doesn't happen? I was also hoping something from within a playbook could solve it as well.
          – Viscosity
          Mar 8 at 16:38




          So you're basically saying I should mess around with the ansible.cfg file to account for this. Could work, but am I able to specify "rollover" working tmp directories to ensure this doesn't happen? I was also hoping something from within a playbook could solve it as well.
          – Viscosity
          Mar 8 at 16:38


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f429055%2fansible-playbook-fails-when-ansible-tmp-directory-path-changes%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

          Morgemoulin

          Scott Moir

          Souastre