gluster / gluster-ansible-repositories Goto Github PK
View Code? Open in Web Editor NEWCollection of Ansible roles for repository management
License: GNU General Public License v3.0
Collection of Ansible roles for repository management
License: GNU General Public License v3.0
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
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) }}"
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
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"}
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.