Running “mvn clean install” maven command using ansible module











up vote
0
down vote

favorite












I am trying to implement the CI/CD pipeline for my project. I am using Ansible , Docker and jenkins. SVN checkout , Image docker image building , image pushing to Dockerhub , Pulling and deploying etc every stages are planning to do using ansible roles.Now I successfully implemented sample svncheckout , image building and pushing and docker image deploying using ansible modules.



I am using Maven build tool.So here I have confusion that , after checkouting from svn repository , I need to run "mvn clean install" using ansible. Noow I am trying to find a ansible module. But i did ot got ansible module . For doing this is there any ansible module for maven like docker_image and svn ? How I can run maven commands using ansible role ?










share|improve this question
























  • Https://docs.ansible.com/ansible has a List of all modules page; and even if there isn’t specifically a mvn install module you can always use the command module to do whatever you need to.
    – David Maze
    Nov 7 at 14:31















up vote
0
down vote

favorite












I am trying to implement the CI/CD pipeline for my project. I am using Ansible , Docker and jenkins. SVN checkout , Image docker image building , image pushing to Dockerhub , Pulling and deploying etc every stages are planning to do using ansible roles.Now I successfully implemented sample svncheckout , image building and pushing and docker image deploying using ansible modules.



I am using Maven build tool.So here I have confusion that , after checkouting from svn repository , I need to run "mvn clean install" using ansible. Noow I am trying to find a ansible module. But i did ot got ansible module . For doing this is there any ansible module for maven like docker_image and svn ? How I can run maven commands using ansible role ?










share|improve this question
























  • Https://docs.ansible.com/ansible has a List of all modules page; and even if there isn’t specifically a mvn install module you can always use the command module to do whatever you need to.
    – David Maze
    Nov 7 at 14:31













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to implement the CI/CD pipeline for my project. I am using Ansible , Docker and jenkins. SVN checkout , Image docker image building , image pushing to Dockerhub , Pulling and deploying etc every stages are planning to do using ansible roles.Now I successfully implemented sample svncheckout , image building and pushing and docker image deploying using ansible modules.



I am using Maven build tool.So here I have confusion that , after checkouting from svn repository , I need to run "mvn clean install" using ansible. Noow I am trying to find a ansible module. But i did ot got ansible module . For doing this is there any ansible module for maven like docker_image and svn ? How I can run maven commands using ansible role ?










share|improve this question















I am trying to implement the CI/CD pipeline for my project. I am using Ansible , Docker and jenkins. SVN checkout , Image docker image building , image pushing to Dockerhub , Pulling and deploying etc every stages are planning to do using ansible roles.Now I successfully implemented sample svncheckout , image building and pushing and docker image deploying using ansible modules.



I am using Maven build tool.So here I have confusion that , after checkouting from svn repository , I need to run "mvn clean install" using ansible. Noow I am trying to find a ansible module. But i did ot got ansible module . For doing this is there any ansible module for maven like docker_image and svn ? How I can run maven commands using ansible role ?







maven docker ansible






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 14:03









kostix

29.6k647101




29.6k647101










asked Nov 7 at 13:36









Jacob

103422




103422












  • Https://docs.ansible.com/ansible has a List of all modules page; and even if there isn’t specifically a mvn install module you can always use the command module to do whatever you need to.
    – David Maze
    Nov 7 at 14:31


















  • Https://docs.ansible.com/ansible has a List of all modules page; and even if there isn’t specifically a mvn install module you can always use the command module to do whatever you need to.
    – David Maze
    Nov 7 at 14:31
















Https://docs.ansible.com/ansible has a List of all modules page; and even if there isn’t specifically a mvn install module you can always use the command module to do whatever you need to.
– David Maze
Nov 7 at 14:31




Https://docs.ansible.com/ansible has a List of all modules page; and even if there isn’t specifically a mvn install module you can always use the command module to do whatever you need to.
– David Maze
Nov 7 at 14:31












2 Answers
2






active

oldest

votes

















up vote
1
down vote













If you couldn't find a module for your specific task, you have two options:




  1. Write your own in Python. Put them into 'library/' directory of the role or playbook.

  2. Use command or shell module to execute desired behavior.


Some systems are way too complex to be quickly implemented as ansible modules, nevertheless, it's often very easy to use their CLI.






share|improve this answer




























    up vote
    0
    down vote













    If you cannot find any ansible plugin for maven. You can use the shell module to do that.
    Here is an example:



      - name: Running mvn clean
    shell: "mvn clean install"
    register: mvn_result

    - name: "mvn clean task output"
    debug:
    var: mvn_result





    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      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: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      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%2fstackoverflow.com%2fquestions%2f53190538%2frunning-mvn-clean-install-maven-command-using-ansible-module%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote













      If you couldn't find a module for your specific task, you have two options:




      1. Write your own in Python. Put them into 'library/' directory of the role or playbook.

      2. Use command or shell module to execute desired behavior.


      Some systems are way too complex to be quickly implemented as ansible modules, nevertheless, it's often very easy to use their CLI.






      share|improve this answer

























        up vote
        1
        down vote













        If you couldn't find a module for your specific task, you have two options:




        1. Write your own in Python. Put them into 'library/' directory of the role or playbook.

        2. Use command or shell module to execute desired behavior.


        Some systems are way too complex to be quickly implemented as ansible modules, nevertheless, it's often very easy to use their CLI.






        share|improve this answer























          up vote
          1
          down vote










          up vote
          1
          down vote









          If you couldn't find a module for your specific task, you have two options:




          1. Write your own in Python. Put them into 'library/' directory of the role or playbook.

          2. Use command or shell module to execute desired behavior.


          Some systems are way too complex to be quickly implemented as ansible modules, nevertheless, it's often very easy to use their CLI.






          share|improve this answer












          If you couldn't find a module for your specific task, you have two options:




          1. Write your own in Python. Put them into 'library/' directory of the role or playbook.

          2. Use command or shell module to execute desired behavior.


          Some systems are way too complex to be quickly implemented as ansible modules, nevertheless, it's often very easy to use their CLI.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 9 at 15:15









          George Shuklin

          1,33551730




          1,33551730
























              up vote
              0
              down vote













              If you cannot find any ansible plugin for maven. You can use the shell module to do that.
              Here is an example:



                - name: Running mvn clean
              shell: "mvn clean install"
              register: mvn_result

              - name: "mvn clean task output"
              debug:
              var: mvn_result





              share|improve this answer

























                up vote
                0
                down vote













                If you cannot find any ansible plugin for maven. You can use the shell module to do that.
                Here is an example:



                  - name: Running mvn clean
                shell: "mvn clean install"
                register: mvn_result

                - name: "mvn clean task output"
                debug:
                var: mvn_result





                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  If you cannot find any ansible plugin for maven. You can use the shell module to do that.
                  Here is an example:



                    - name: Running mvn clean
                  shell: "mvn clean install"
                  register: mvn_result

                  - name: "mvn clean task output"
                  debug:
                  var: mvn_result





                  share|improve this answer












                  If you cannot find any ansible plugin for maven. You can use the shell module to do that.
                  Here is an example:



                    - name: Running mvn clean
                  shell: "mvn clean install"
                  register: mvn_result

                  - name: "mvn clean task output"
                  debug:
                  var: mvn_result






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 10 at 0:00









                  Yassine Fadhlaoui

                  717




                  717






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53190538%2frunning-mvn-clean-install-maven-command-using-ansible-module%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







                      這個網誌中的熱門文章

                      Academy of Television Arts & Sciences

                      L'Équipe

                      1995 France bombings