ansibleplaybookbundle / ansible-playbook-bundle

THIS REPO IS MIGRATING: https://github.com/automationbroker/apb
GNU General Public License v2.0
140 stars 70 forks source link

When Removing (deprovision) Role Binding I get #133

Open slaskawi opened 7 years ago

slaskawi commented 7 years ago

Deprovisioning service with Role Binding results in error:

fatal: [localhost]: FAILED! => {"changed": false, "error": 403, "failed": true, "msg": "Failed to retrieve requested object: User \"system:serviceaccount:myproject:apb-3e385e84-6a7a-4e2f-a344-4b81d0a838f2\" cannot get rolebindings in project \"myproject\""}

Full logs:

+ [[ deprovision --extra-vars {"_apb_plan_id":"caching-service","application_name":"caching-service-app","docker_image":"docker-registry.engineering.redhat.com/jboss-dataservices/datagrid-online-services","namespace":"myproject"} == *\s\2\i\/\a\s\s\e\m\b\l\e* ]]
--
  | + ACTION=deprovision
  | + shift
  | + playbooks=/opt/apb/actions
  | + CREDS=/var/tmp/bind-creds
  | + TEST_RESULT=/var/tmp/test-result
  | + whoami
  | + '[' -w /etc/passwd ']'
  | ++ id -u
  | + echo 'apb:x:1000060000:0:apb user:/opt/apb:/sbin/nologin'
  | + oc-login.sh
  | Attempting to login with a service account...
  | Logged into "https://kubernetes.default:443" as "system:serviceaccount:myproject:apb-3e385e84-6a7a-4e2f-a344-4b81d0a838f2" using the token provided.
  | You have one project on this server: "myproject"
  | Using project "myproject".
  | Welcome! See 'oc help' to get started.
  | + set +x
  | ls: cannot access /etc/apb-secrets: No such file or directory
  | + [[ -e /opt/apb/actions/deprovision.yaml ]]
  | + [[ -e /opt/apb/actions/deprovision.yml ]]
  | + ANSIBLE_ROLES_PATH=/etc/ansible/roles:/opt/ansible/roles
  | + ansible-playbook /opt/apb/actions/deprovision.yml --extra-vars '{"_apb_plan_id":"caching-service","application_name":"caching-service-app","docker_image":"docker-registry.engineering.redhat.com/jboss-dataservices/datagrid-online-services","namespace":"myproject"}'
  | PLAY [datagrid-online-services-apb playbook to deprovision the application] ****
  | TASK [ansible.kubernetes-modules : Install latest openshift client] ************
  | skipping: [localhost]
  | TASK [deprovision-datagrid-online-services-apb : Delete Service Account] *******
  | ok: [localhost]
  | TASK [deprovision-datagrid-online-services-apb : Delete Role Binding] **********
  | fatal: [localhost]: FAILED! => {"changed": false, "error": 403, "failed": true, "msg": "Failed to retrieve requested object: User \"system:serviceaccount:myproject:apb-3e385e84-6a7a-4e2f-a344-4b81d0a838f2\" cannot get rolebindings in project \"myproject\""}
  | to retry, use: --limit @/opt/apb/actions/deprovision.retry
  | PLAY RECAP *********************************************************************
  | localhost                  : ok=1    changed=0    unreachable=0    failed=1
  | + EXIT_CODE=2
  | + set +ex
  | + '[' -f /var/tmp/test-result ']'
  | + '[' -f /var/tmp/bind-creds ']'
  | + exit 2

Deprovision snippet:

- name: Delete Role Binding
  openshift_v1_role_binding:
    namespace: '{{ namespace }}'
    name: '{{ application_name }}'
    state: absent
Asgoret commented 5 years ago

@jmrodri Hi! I catch this error today too. Is there any solution? I tried to provision as cluster-admin, and as simple developer. Also i tries install this script, but it didn't work.

I use minishift on macOS v3.11 and think every docker image is tag latest