Code Monkey home page Code Monkey logo

gluster-ansible-repositories's Introduction

gluster-ansible-repositories

Collection of Ansible roles for repository management

Requirements

Ansible version 2.5 or above

Role Variables

Name Choices Default value Comments
gluster_repos_activationkey UNDEF Activation key for enabling the repositories
gluster_repos_attach yes/no no Whether to auto-attach the available repositories
gluster_repos_username UNDEF Username for the subscription-manager command
gluster_repos_password UNDEF Password for the subscription-manager command
gluster_repos_force yes/no no If set to yes, subscription-manager registers by force even if already registerd
gluster_repos_pools UNDEF List of pool ids to attach
gluster_repos_disable_all yes/no yes Disable all the repositories before attaching to new repositories
gluster_repos_rhsmrepos UNDEF List of repositories to enable
gluster_repos_hci_subscribe UNDEF Attach to HCI repositories
gluster_repos_nfsganesha_subscribe UNDEF Attach to list of NFS Ganesha repositories
gluster_repos_smb_subscribe UNDEF Attach to list of SMB repositores
gluster_repos_packages UNDEF Install the listed packages

Tags

Name Comments
activationkey Subscribe to RHSM using activation key
register Register to RHSM using username and password
attachpools Attach the pools to RHSM
disablerepos Disable all the repos
enablerepos Enable the given set of repositories
hcisubscribe Enable the repositories required for HCI
nfsganeshasubscribe Enable the repositories required for NFS Ganesha
smbsubscribe Enable the repositories required for Samba
installpackages Install the list of packages

Example Playbook

Subscribe to RHSM using username and password and attach to a pool

---
- name: Subscribe to RHSM
  hosts: rhsm
  remote_user: root
  gather_facts: no

  vars:
    gluster_repos_username: <user>@redhat.com
    # Ensure to encrypt the password variable using ansible-vault
    gluster_repos_password: <passwd>
    gluster_repos_disable_all: true
    gluster_repos_pools: 9c31g9713e3adareak203r3adfa4e950
    gluster_repos_rhsmrepos:
       - rhel-7-server-rpms
       - rh-gluster-3-for-rhel-7-server-rpms
       - rh-gluster-3-nfs-for-rhel-7-server-rpms
       - rhel-ha-for-rhel-7-server-rpms
  roles:
    - gluster.repos

gluster-ansible-repositories's People

Contributors

devyanikota avatar gobindadas avatar leifmadsen avatar pkesavap avatar prajith007007 avatar rchikatw avatar sac avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gluster-ansible-repositories's Issues

Missing default vaule for gluster_repos_attach

The variable "gluster_repos_attach" does not have a default value as mentioned in the documentation :

# grep -rin gluster_repos_attach /etc/ansible/roles/gluster.repos/
/etc/ansible/roles/gluster.repos/tasks/main.yml:20:     auto_attach: "{{ gluster_repos_attach }}"    <<<<<<<<
/etc/ansible/roles/gluster.repos/tasks/main.yml:31:     auto_attach: "{{ gluster_repos_attach | default(omit) }}"

Unable to use activation key using gluster-ansible-repositories

Following sample code is not working :

$ cat test.yml
---
- name: Subscribe to RHSM
  hosts: master_client
  remote_user: root
  gather_facts: no
  vars:
    gluster_repos_activationkey: xxxxxx       
    gluster_repos_rhsmrepos:
       - rhel-7-server-rpms
       - rh-gluster-3-for-rhel-7-server-rpms
       - rh-gluster-3-nfs-for-rhel-7-server-rpms
       - rhel-ha-for-rhel-7-server-rpms
  roles:
    - gluster.repos

I am getting the following error message :

    $ ansible-playbook  -i hosts test.yml

    PLAY [Subscribe to RHSM] ***************************************************************************************************************************************************

    TASK [gluster.repos : Check if username variable is set] *******************************************************************************************************************
    skipping: [server1.example.com]

    TASK [gluster.repos : Check if password variable is set] *******************************************************************************************************************
    fatal: [server1.example.com]: FAILED! => {"msg": "The conditional check 'gluster_repos_activationkey not is defined' failed. The error was: template error while templating string: expected token 'end of statement block', got 'not'. String: {% if gluster_repos_activationkey not is defined %} True {% else %} False {% endif %}\n\nThe error appears to be in '/etc/ansible/roles/gluster.repos/tasks/main.yml': line 9, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name:  Check if password variable is set\n  ^ here\n"}

    PLAY RECAP *****************************************************************************************************************************************************************
    server1.example.com : ok=0    changed=0    unreachable=0    failed=1    skipped=1    rescued=0    ignored=0   

Packages installed :

$ rpm -qa | grep gluster-ansible
gluster-ansible-maintenance-1.0.1-3.fc32.noarch
gluster-ansible-infra-1.0.4-10.fc32.noarch
gluster-ansible-1.0.5-1.fc31.noarch
gluster-ansible-cluster-1.0.1-2.fc32.noarch
gluster-ansible-repositories-1.0.1-2.fc32.noarch    <<<<<<<<<<
gluster-ansible-features-1.0.5-6.fc32.noarch

Request to use default pool id.

When trying to use activation key manually, I did not have to use any pool id, it auto attached to the available pool but here this seems to be mandatory.

TASK [gluster.repos : check if gluster_repos_pools is set] **********************************************************************************************************************************
fatal: [server1.example.com]: FAILED! => {"changed": false, "msg": "Please provide List of pool ids to attach"}

Documentation mentions wrong role name.

Packages installed :

$ rpm -qa | grep gluster-ansible
gluster-ansible-maintenance-1.0.1-3.fc32.noarch
gluster-ansible-infra-1.0.4-10.fc32.noarch
gluster-ansible-1.0.5-1.fc31.noarch
gluster-ansible-cluster-1.0.1-2.fc32.noarch
gluster-ansible-repositories-1.0.1-2.fc32.noarch    <<<<<<<<<<
gluster-ansible-features-1.0.5-6.fc32.noarch

Files installed by the package :

$ rpm -ql gluster-ansible-repositories-1.0.1-2.fc32.noarch
/etc/ansible/roles/gluster.repos
/etc/ansible/roles/gluster.repos/LICENSE
/etc/ansible/roles/gluster.repos/defaults
/etc/ansible/roles/gluster.repos/defaults/main.yml
/etc/ansible/roles/gluster.repos/meta
/etc/ansible/roles/gluster.repos/meta/main.yml
/etc/ansible/roles/gluster.repos/tasks
/etc/ansible/roles/gluster.repos/tasks/hci.yml
/etc/ansible/roles/gluster.repos/tasks/main.yml
/etc/ansible/roles/gluster.repos/tasks/nfsganesha.yml
/etc/ansible/roles/gluster.repos/tasks/smb.yml
/usr/share/doc/gluster.repos
/usr/share/doc/gluster.repos/README.md   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/usr/share/doc/gluster.repos/examples    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
/usr/share/doc/gluster.repos/examples/subscribe_and_register.yml
/usr/share/doc/gluster.repos/examples/subscribe_hci.yml
/usr/share/licenses/gluster-ansible-repositories
/usr/share/licenses/gluster-ansible-repositories/LICENSE

Documentation that is the README.md mentions wrong role name :

$ tail -20 /usr/share/doc/gluster.repos/README.md
---
- name: Subscribe to RHSM
  hosts: rhsm
  remote_user: root
  gather_facts: no

  vars:
    gluster_repos_username: <user>@redhat.com
    # Ensure to encrypt the password variable using ansible-vault
    gluster_repos_password: <passwd>
    gluster_repos_disable_all: true
    gluster_repos_pools: 9c31g9713e3adareak203r3adfa4e950
    gluster_repos_rhsmrepos:
       - rhel-7-server-rpms
       - rh-gluster-3-for-rhel-7-server-rpms
       - rh-gluster-3-nfs-for-rhel-7-server-rpms
       - rhel-ha-for-rhel-7-server-rpms
  roles:
    - gluster.repositories     <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<   (this does not work, it says no such role )

But the example mentions the right role name :

$ cat /usr/share/doc/gluster.repos/examples/subscribe_and_register.yml
---
- name: Subscribe to RHSM
  hosts: rhsm
  remote_user: root
  gather_facts: no
  no_log: True

  vars:
    gluster_repos_username: <user>@redhat.com
    # Ensure to encrypt the password variable using vault
    gluster_repos_password: <passwd>
    gluster_repos_disable_all: true
    gluster_repos_pools: <pool-id>
    gluster_repos_rhsmrepos:
       - rhel-7-server-rpms
       - rh-gluster-3-for-rhel-7-server-rpms
       - rh-gluster-3-nfs-for-rhel-7-server-rpms
       - rhel-ha-for-rhel-7-server-rpms
  roles:
    - gluster.repos   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  (but this works, it recognizes the role but throws the error mentioned in the above email thread)

unable to use activation key as org_id is missing

When using activation key org_id becomes a mandatory field, which is missing.
The below snip can be used to fix this, I tried it in my env and it works.

- name: Register with activation key, if activation key is provided
  redhat_subscription:
     state: present
     activationkey: "{{ gluster_repos_activationkey }}"
     org_id: "{{ gluster_repos_org_id }}"  <<<<<<<<<<<<<<<(This was missing, added this and then the script moved ahead)
     auto_attach: "{{ gluster_repos_attach }}"
  when: gluster_repos_activationkey is defined and
        gluster_repos_activationkey
  tags: activationkey

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.