Pulp
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- title: Host your own on-premise Ansible Galaxy tags: Ansible, pulp_ansible, galaxy_ng, fosdem, devconf.cz description: Setup an on-premise Ansible Galaxy system with or without a UI --- ### Host your own on-premise Ansible Galaxy Brian Bouterse Senior Principal Software Engineer bmbouter@redhat.com slides: https://hackmd.io/@pulp/ansible-containers#/ --- ## Agenda * Setting up an On-Premise Galaxy * with UI * without UI * Syncing in collections/roles from galaxy.ansible.com * Installing collections/roles using CLI * Uploading collections via ansible CLI * Organizing content in repositories --- ## Software --- ### Galaxy NG - https://github.com/ansible/galaxy_ng/ * A fork+rewrite of original Galaxy code * Has a UI * Developed by the same team that runs galaxy.ansible.com * Only Collection support * GPLv2 --- ### pulp_ansible - https://github.com/pulp/pulp_ansible * The backend of galaxy NG * API and CLI Only, No-UI * Collection and Role Support * GPLV2 --- ## Deploy Galaxy NG --- ### Pulling down the container `podman pull pulp/pulp-galaxy-ng` --- ### Create settings files ``` mkdir galaxy_ng cd galaxy_ng mkdir settings pulp_storage pgsql containers ``` ``` echo "CONTENT_ORIGIN='http://$(hostname):8080' ANSIBLE_API_HOSTNAME='http://$(hostname):8080' ANSIBLE_CONTENT_HOSTNAME='http://$(hostname):8080/pulp/content'" >> settings/settings.py ``` --- ### Start the container with SELinux * Running on port 8080 * http only (currently) * Usable with either `podman` or `docker` commands ``` podman run --detach \ --publish 8080:80 \ --name galaxy_ng \ --volume ./settings:/etc/pulp:Z \ --volume ./pulp_storage:/var/lib/pulp:Z \ --volume ./pgsql:/var/lib/pgsql:Z \ --volume ./containers:/var/lib/containers:Z \ --device /dev/fuse \ pulp/pulp-galaxy-ng ``` --- ### Start the container *without* SELinux ``` podman run --detach \ --publish 8080:80 \ --name galaxy_ng \ --volume ./settings:/etc/pulp \ --volume ./pulp_storage:/var/lib/pulp \ --volume ./pgsql:/var/lib/pgsql \ --volume ./containers:/var/lib/containers \ --device /dev/fuse \ pulp/pulp-galaxy-ng ``` --- ### Load required initial data ``` DATA_FIXTURE_URL="https://raw.githubusercontent.com/ansible/galaxy_ng/master/dev/automation-hub/initial_data.json" curl $DATA_FIXTURE_URL | podman exec -i galaxy_ng bash -c "cat > /tmp/initial_data.json" podman exec galaxy_ng bash -c "/usr/local/bin/pulpcore-manager loaddata /tmp/initial_data.json" ``` --- ### Assign an admin password `podman exec -it galaxy_ng bash -c 'pulpcore-manager reset-admin-password'` --- ### Basics Accessing the UI: http://localhost:8080 Showing the logs: `podman logs -f galaxy_ng` --- ## Use Galaxy NG 1. Show the Repositories 2. Show the Remotes 3. Sync Content --- ### Two requirements file examples ``` --- collections: # With just the collection name - pulp.pulp_installer - ansible.posix ``` ``` --- collections: # With just the collection name - amazon.aws ``` --- ### Gotchas * It does not currently provide dependency resolution * Every time you sync, it overwrites the previous content * Don't have a ~/.netrc file or it won't use your token --- ### Configuring the CLI 1. Get the config file from the UI 2. Add the token from the UI 3. Install with a command like: `ansible-galaxy collection install -p ./ pulp.pulp_installer` --- ### Uploading content from the UI 1. Have a local collection, e.g. https://galaxy.ansible.com/newswangerd/collection_demo 2. Create a "namespace" in the UI 3. Upload a built collection 4. Go through the approval workflow --- ### You can turn off the approval workflow Add this to `settings.py`: ``` galaxy_require_content_approval=False ``` https://github.com/ansible/galaxy_ng/wiki/Enabling-auto-certification --- ### Users, Groups, Permissions --- ### Uploading content from the CLI 1. Same as from the UI, except use the `ansible-galaxy collection publish` command --- ## Deploy Pulp_Ansible --- ### Pulling down the container `podman pull pulp/pulp` --- ### Create settings files ``` mkdir pulp cd pulp mkdir settings pulp_storage pgsql containers ``` ``` echo "CONTENT_ORIGIN='http://$(hostname):8080' ANSIBLE_API_HOSTNAME='http://$(hostname):8080' ANSIBLE_CONTENT_HOSTNAME='http://$(hostname):8080/pulp/content' TOKEN_AUTH_DISABLED=True" >> settings/settings.py ``` --- ### Start the container with SELinux * Running on port 8080 * http only (currently) * Usable with either `podman` or `docker` commands ``` podman run --detach \ --publish 8080:80 \ --name pulp \ --volume ./settings:/etc/pulp:Z \ --volume ./pulp_storage:/var/lib/pulp:Z \ --volume ./pgsql:/var/lib/pgsql:Z \ --volume ./containers:/var/lib/containers:Z \ --device /dev/fuse \ pulp/pulp ``` --- ### Start the container *without* SELinux ``` podman run --detach \ --publish 8080:80 \ --name pulp \ --volume ./settings:/etc/pulp \ --volume ./pulp_storage:/var/lib/pulp \ --volume ./pgsql:/var/lib/pgsql \ --volume ./containers:/var/lib/containers \ --device /dev/fuse \ pulp/pulp ``` --- ### Assign an admin password `podman exec -it pulp bash -c 'pulpcore-manager reset-admin-password'` --- ### Installing pulp-cli `pip install pulp-cli` https://github.com/pulp/pulp-cli --- ### Point pulp-cli at your container `pulp config create` `pulp config edit` 1. Point to "http://localhost:8080" 2. Add username, password --- ### Basics Showing the logs: `podman logs -f pulp` Status check: `pulp status` API Documentation: http://localhost:8080/pulp/api/v3/docs/ --- ### Create an Ansible Repository * `pulp ansible repository create --name myrepo` * `pulp ansible repository list` --- ### Create an Ansible Remote * `pulp ansible remote -t collection create --name basic --url https://galaxy.ansible.com --requirements-file ~/Documents/Presentations/container_demo/basic.yml` * `pulp ansible remote list` --- ### Create an Ansible Distribution * `pulp ansible distribution create --name mydistro --base-path foo --repository myrepo` * `pulp ansible distribution list` --- ### View it through the Galaxy API `http://localhost.localdomain:8080/pulp_ansible/galaxy/foo/api/v3/collections/` --- ### Sync content using the Remote into the Repo `pulp ansible repository sync --name myrepo --remote basic` --- ### Installing using the CLI 1. Get the client URL for this repo from the distribution list: `pulp ansible distribution list` 2. Install with a command like: `ansible-galaxy collection install -s http://localhost.localdomain:8080/pulp_ansible/galaxy/foo/ -p ./ pulp.pulp_installer` --- ### Uploading from the CLI (part 1) * Get the client URL for this repo from the distribution list: `pulp ansible distribution list` * Have a tarball, e.g. `https://galaxy.ansible.com/newswangerd/collection_demo` --- ### Uploading from the CLI (part 2) * Upload the tarball with `ansible-galaxy collection publish -s http://localhost.localdomain:8080/pulp_ansible/galaxy/foo/ newswangerd-collection_demo-1.0.10.tar.gz` * View it's availability in the repository: `http://localhost.localdomain:8080/pulp_ansible/galaxy/foo/api/v3/collections/` --- ### Creating a remote for Role content 1. First a word about the galaxy Role API 2. `pulp ansible remote -t role create --name someroles --url https://galaxy.ansible.com/api/v1/roles/?namespace__name=elastic` --- ### Syncing Roles `pulp ansible repository sync --name myrepo --remote someroles` Viewing them: `http://localhost.localdomain:8080/pulp_ansible/galaxy/foo/api/v1/roles/` --- ### Installing Roles from the CLI 1. Get the client URL for this repo from the distribution list: `pulp ansible distribution list` 2. Install with a command like: `ansible-galaxy role install -s http://localhost.localdomain:8080/pulp_ansible/galaxy/foo/ -p ./ elasticsearch,6.2.4` --- ### Configuring the CLI permanently Use an ansible.cfg like: ``` [galaxy] server: http://localhost.localdomain:8080/pulp_ansible/galaxy/foo/ ``` Then `ansible-galaxy role install -p ./ elasticsearch,6.2.4` --- ### Copying Content between Repositories Not demo-ing but see these docs: https://docs.pulpproject.org/pulp_ansible/workflows/copy.html --- ### Getting Help * https://www.redhat.com/mailman/listinfo/pulp-list * https://www.redhat.com/mailman/listinfo/galaxy-ng * #pulp on Freenode * See the docs for filing bugs, changes, etc. --- ### Feedback Brian Bouterse bmbouter@redhat.com ---

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully