[Pulp-list] Create and remove repo with ansible

Kodiak Firesmith kfiresmith at gmail.com
Tue Apr 9 14:00:44 UTC 2019


For Pulp 2.x, I use this plus some extra commands:
https://docs.ansible.com/ansible/latest/modules/pulp_repo_module.html

On Tue, Apr 9, 2019 at 9:48 AM Juan Cabrera <juan.cabrera at unamur.be> wrote:

> Hi,
>
> Is there an ansible module to add or remove a rpm repository ?
>
> I send in attachment the scripts I use for the moment to create and remove
> the rpm repositories.
>
> I use this:
>
> vars:
>
>    - pulp_repos:
>       - repo: epel_ptci
>         remote: epel
>         remote_url: https://epel.mirror.it2go.eu/7/x86_64/
>         state: present
>
> TODO: to become idempotent, check if repo already exists
>
> - name: config | Add repositories.
>   command: ~/create_repo --repo "{{ item.repo }}" --remote "{{ item.remote
> }}" --href "{{ item.remote_url }}"
>   loop: "{{ pulp_repos }}"
>   when: item.state is not defined or item.state == 'present'
>   become: yes
>   become_user: "{{ pulp_repo_user }}"
>
>
> - name: config | Remove repositories
>   command: ~/remove_repo --repo "{{ item.repo }}" --remote "{{ item.remote
> }}"
>   loop: "{{ pulp_repos }}"
>   when: item.state is defined and item.state == 'absent'
>   become: yes
>   become_user: "{{ pulp_repo_user }}"
>
> What is the best way to check if a repo already exist?
>
> Juan
> --
>
> Juan CABRERA
> Correspondant informatique
> Département de Mathématiques
>
> T. 081724919
> juan.cabrera at unamur.be
> http://staff.unamur.be/jbcabrer
>
> Université de Namur ASBL
> Rue de Bruxelles 61 - 5000 Namur
> Belgique
>
> Let’s respect the environment together.
> Only print this message if necessary!
> _______________________________________________
> Pulp-list mailing list
> Pulp-list at redhat.com
> https://www.redhat.com/mailman/listinfo/pulp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190409/c3dc6ed2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lhmcljcamdohejfn.png
Type: image/png
Size: 9356 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/pulp-list/attachments/20190409/c3dc6ed2/attachment.png>


More information about the Pulp-list mailing list