Skip to content

Instantly share code, notes, and snippets.

@rochacbruno
Forked from chouseknecht/enduser-install-vars.yml
Last active February 23, 2021 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rochacbruno/3e181f7931d12068cd09b9dde3a2c09e to your computer and use it in GitHub Desktop.
Save rochacbruno/3e181f7931d12068cd09b9dde3a2c09e to your computer and use it in GitHub Desktop.
pulp_default_admin_password: password
pulp_install_source: pip
pulp_settings:
secret_key: secret
content_origin: "https://{{ inventory_hostname }}"
x_pulp_api_host: 127.0.0.1
x_pulp_api_port: 24817
x_pulp_api_user: "admin"
x_pulp_api_password: "{{ pulp_default_admin_password }}"
x_pulp_api_prefix: "pulp_ansible/galaxy/automation-hub/api"
galaxy_require_content_approval: "False"
pulp_token_auth_disabled: "True"
galaxy_api_default_distribution_base_path: "published"
pulp_install_plugins:
pulp-ansible:
version: 0.7.0
galaxy-ng: {}
pulp-container:
version: 2.3.1
pulp_api_workers: 4
---
- hosts: all
roles:
- pulp.pulp_installer.pulp_all_services
environment:
DJANGO_SETTINGS_MODULE: pulpcore.app.settings
pre_tasks:
- name: Install RHEL7 redis
set_fact:
pulp_redis_package_name: 'rh-redis5'
pulp_redis_server_name: 'rh-redis5-redis'
pulp_redis_conf_file: '/etc/opt/rh/rh-redis5/redis.conf'
when: ansible_distribution_major_version == '7'
- hosts: all
roles:
- ansible.galaxy_collection.post_install_config
pre_tasks:
- name: Clean OpenAPI cache
file:
path: "{{ lookup('env', 'XDG_CACHE_HOME') | default('~/.cache') }}/squeezer"
state: absent
post_tasks:
- name: Get services
service_facts:
- name: Restart all pulpcore* services
systemd:
daemon_reload: true
name: "{{ item.value.name }}"
state: restarted
when: "item.value.name != 'pulpcore-worker@.service'"
with_dict: '{{ ansible_facts.services|dict2items|selectattr("key", "contains", "pulpcore")|list|items2dict }}'
become: true
---
- hosts: all
roles:
- ansible.galaxy_collection.post_install_config
pre_tasks:
- name: Reload systemd
systemd:
daemon_reload: true
become: true
- name: Restart all pulpcore* services
command: systemctl restart pulpcore*
become: true
- name: Clean OpenAPI cache
file:
path: "{{ lookup('env', 'XDG_CACHE_HOME') | default('~/.cache') }}/squeezer"
state: absent
# Options
pulp_devel_supplement_bashrc: true
pulp_default_admin_password: password
pulp_api_workers: 4
pulp_settings:
secret_key: "unsafe_default"
content_origin: "http://{{ ansible_fqdn }}"
x_pulp_api_host: 127.0.0.1
x_pulp_api_port: 24817
x_pulp_api_user: "admin"
x_pulp_api_password: "{{ pulp_default_admin_password }}"
x_pulp_api_prefix: "pulp_ansible/galaxy/automation-hub/api"
galaxy_require_content_approval: "False"
pulp_token_auth_disabled: "True"
galaxy_api_default_distribution_base_path: "published"
pulp_install_plugins:
pulp-ansible:
source_dir: "/home/vagrant/devel/pulp_ansible"
galaxy-ng:
source_dir: "/home/vagrant/devel/galaxy_ng"
pulp-container:
source_dir: "/home/vagrant/devel/pulp_container"
# Vagrant source install Required
pulp_user: "vagrant"
developer_user: "vagrant"
developer_user_home: "/home/vagrant"
pulp_source_dir: "/home/vagrant/devel/pulpcore"
---
- hosts: all
vars:
galaxy_api_url: http://localhost:5001/api/automation-hub/
galaxy_username: admin
galaxy_password: password
galaxy_namespace:
name: "newswangerd"
description: "Example collections"
galaxy_collection_path: newswangerd-collection_demo-1.0.10.tar.gz
tasks:
- name: Authenticate and get an API token
uri:
url: "{{ galaxy_api_url }}v3/auth/token/"
method: POST
url_username: "{{ galaxy_username }}"
url_password: "{{ galaxy_password }}"
force_basic_auth: yes
status_code: 200
body_format: json
return_content: yes
register: galaxy_auth_response
- set_fact:
galaxy_token: "{{ galaxy_auth_response['json']['token'] }}"
- set_fact:
galaxy_auth_header: "Token {{ galaxy_token }}"
- name: Check if the namespace exists
uri:
url: "{{galaxy_api_url}}v3/namespaces/{{ galaxy_namespace.name }}/"
method: GET
headers:
Authorization: "{{ galaxy_auth_header }}"
register: galaxy_namespace_check
ignore_errors: yes
- name: Create a namespace
uri:
url: "{{galaxy_api_url}}v3/namespaces/"
method: POST
headers:
Authorization: "{{ galaxy_auth_header }}"
body_format: json
body:
name: "{{ galaxy_namespace.name }}"
description: "{{ galaxy_namespace.description }}"
groups:
- name: "system:partner-engineers"
return_content: yes
status_code: 201
register: galaxy_namespace_response
when: galaxy_namespace_check.status == 404
- debug:
var: galaxy_namespace_response
- name: create ansible.cfg
copy:
dest: ansible.cfg
content: |
[galaxy]
server_list = local_server
[galaxy_server.local_server]
url={{ galaxy_api_url }}
token={{ galaxy_token }}
- name: publish a collection with ansible-galaxy
shell:
cmd: ANSIBLE_CONFIG=./ansible.cfg ansible-galaxy collection publish -v {{ galaxy_collection_path }}
pulp_default_admin_password: password
pulp_settings:
secret_key: secret
content_origin: "https://{{ inventory_hostname }}"
x_pulp_api_host: 127.0.0.1
x_pulp_api_port: 24817
x_pulp_api_user: "admin"
x_pulp_api_password: "{{ pulp_default_admin_password }}"
x_pulp_api_prefix: "pulp_ansible/galaxy/automation-hub/api"
galaxy_require_content_approval: "False"
pulp_token_auth_disabled: "True"
galaxy_api_default_distribution_base_path: "published"
pulp_pkg_repo: 'https://yum.theforeman.org/pulpcore/3.7/el{{ ansible_distribution_major_version }}/x86_64'
pulp_install_source: packages
pulp_install_plugins:
pulp-ansible:
version: 0.5.5
galaxy-ng: {}
pulp-container:
version: 2.1.0
pulp_api_workers: 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment