<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>Is there an ansible module to add or remove a rpm repository ?<br>
    </p>
    <p>I send in attachment the scripts I use for the moment to create
      and remove the rpm repositories.</p>
    <p>I use this:</p>
    <p><tt>vars:</tt></p>
    <tt> </tt>
    <p><tt>   - pulp_repos:</tt><tt><br>
      </tt><tt>       - repo: epel_ptci</tt><tt><br>
      </tt><tt>         remote: epel</tt><tt><br>
      </tt><tt>         remote_url: <a class="moz-txt-link-freetext"
          href="https://epel.mirror.it2go.eu/7/x86_64/"
          moz-do-not-send="true">https://epel.mirror.it2go.eu/7/x86_64/</a></tt><tt><br>
      </tt><tt>         state: present</tt></p>
    <tt> </tt>
    <p><tt>TODO: to become idempotent, check if repo already exists</tt></p>
    <tt> </tt>
    <p><tt>- name: config | Add repositories. </tt><tt><br>
      </tt><tt>   command: ~/create_repo --repo "{{ item.repo }}"
        --remote "{{ item.remote }}" --href "{{ item.remote_url }}"</tt><tt><br>
      </tt><tt>   loop: "{{ pulp_repos }}"</tt><tt><br>
      </tt><tt>   when: item.state is not defined or item.state ==
        'present'</tt><tt><br>
      </tt><tt>   become: yes</tt><tt><br>
      </tt><tt>   become_user: "{{ pulp_repo_user }}"</tt></p>
    <tt> </tt>
    <p><tt><br>
      </tt><tt> - name: config | Remove repositories</tt><tt><br>
      </tt><tt>   command: ~/remove_repo --repo "{{ item.repo }}"
        --remote "{{ item.remote }}"</tt><tt><br>
      </tt><tt>   loop: "{{ pulp_repos }}"</tt><tt><br>
      </tt><tt>   when: item.state is defined and item.state == 'absent'</tt><tt><br>
      </tt><tt>   become: yes</tt><tt><br>
      </tt><tt>   become_user: "{{ pulp_repo_user }}"</tt></p>
    <p>What is the best way to check if a repo already exist?</p>
    <p>Juan</p>
    <div class="moz-signature">-- <br>
      <div style="font-family: Verdana, Helvetica, Arial, sans-serif;
        font-size: 8pt; font-weight: normal; color: #616365;"> <img
          src="cid:part2.79D9AF93.B11A3CAF@unamur.be" style="display:
          block; margin: 1em 0em;" class="">
        <p style="margin: 1em;"> <span style="font-weight: bold;">Juan
            CABRERA</span><br>
          <span style="color: #69BE28;">Correspondant informatique</span><br>
          <span>Département de Mathématiques</span> </p>
        <p style="margin: 1em;"> <span style="font-weight: bold;">T.</span>
          081724919<br>
          <a style="color: #69BE28;"
            href="mailto:juan.cabrera@unamur.be" moz-do-not-send="true">juan.cabrera@unamur.be</a><br>
          <a style="color: #69BE28;"
            href="http://staff.unamur.be/jbcabrer"
            moz-do-not-send="true">http://staff.unamur.be/jbcabrer</a> </p>
        <p style="margin: 1em;"> <span style="font-weight: bold;
            font-size: 8pt;">Université de Namur ASBL</span><br>
          <span>Rue de Bruxelles 61 - 5000 Namur</span><br>
          <span>Belgique</span><br>
        </p>
        <p style="margin: 1em; font-size: 6pt; color: #69BE28;"> <span>Let’s
            respect the environment together.</span><br>
          <span style="font-weight: bold;">Only print this message if
            necessary!</span><br>
        </p>
      </div>
    </div>
  </body>
</html>