Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1512723

Summary: ansible to uninstall prometheus throws error serviceaccounts "prometheus" not found
Product: OKD Reporter: Peter Ruan <pruan>
Component: InstallerAssignee: Scott Dodson <sdodson>
Status: CLOSED DUPLICATE QA Contact: Johnny Liu <jialiu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: aos-bugs, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-11-14 00:55:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Peter Ruan 2017-11-13 23:12:07 UTC
Description of problem:
After a successful installation of Prometheus service, I run the uninstall operation by add the parameter 'openshift_prometheus_state=absent'  into my inventory file.  Ansible exited during the annotate_serviceaccount operation, however the pod 'prometheus-0' and project 'openshift-metrics' were removed successfully from the instance.  

The error being 'serviceaccounts "prometheus" not found

Version-Release number of selected component (if applicable):


How reproducible:
always,

Steps to Reproduce:
1. install Prometheus successfully
2. try to uninstall by setting openshift_prometheus_state=absent in the inventory file.
3.

Actual results:
    TASK [openshift_prometheus : create prometheus serviceaccount] *****************
          task path: /usr/share/ansible/openshift-ansible/roles/openshift_prometheus/tasks/install_prometheus.yaml:25
          Monday 13 November 2017  21:15:38 +0000 (0:00:01.409)       0:00:27.465 *******
          ok: [host-8-241-75.host.centralci.eng.rdu2.redhat.com] => {"changed": false, "failed": false, "results": {"cmd": "/usr/bin/oc delete sa prometheus -n openshift-metrics", "results": {}, "returncode": 0}, "state": "absent"}
         
          TASK [openshift_prometheus : annotate serviceaccount] **************************
          task path: /usr/share/ansible/openshift-ansible/roles/openshift_prometheus/tasks/install_prometheus.yaml:40
          Monday 13 November 2017  21:15:38 +0000 (0:00:00.812)       0:00:28.278 *******
          fatal: [host-8-241-75.host.centralci.eng.rdu2.redhat.com]: FAILED! => {"changed": true, "cmd": ["oc", "annotate", "--overwrite", "-n", "openshift-metrics", "serviceaccount", "prometheus", "serviceaccounts.openshift.io/oauth-redirectreference.prom={\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"prometheus\"}}", "serviceaccounts.openshift.io/oauth-redirectreference.alerts={\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"alerts\"}}"], "delta": "0:00:00.170896", "end": "2017-11-13 16:15:39.364896", "failed": true, "msg": "non-zero return code", "rc": 1, "start": "2017-11-13 16:15:39.194000", "stderr": "Error from server (NotFound): serviceaccounts \"prometheus\" not found", "stderr_lines": ["Error from server (NotFound): serviceaccounts \"prometheus\" not found"], "stdout": "", "stdout_lines": []}
            to retry, use: --limit @/usr/share/ansible/openshift-ansible/playbooks/byo/openshift-cluster/openshift-prometheus.retry
         
          PLAY RECAP *********************************************************************
          host-8-241-75.host.centralci.eng.rdu2.redhat.com : ok=48   changed=4    unreachable=0    failed=1  
          localhost                  : ok=10   changed=0    unreachable=0    failed=0  
         
         
          INSTALLER STATUS ***************************************************************
          Initialization             : Complete
          Prometheus Install         : In Progress
            This phase can be restarted by running: playbooks/byo/openshift-cluster/openshift-prometheus.yml
         
          Monday 13 November 2017  21:15:39 +0000 (0:00:00.431)       0:00:28.709 *******
          ===============================================================================
          openshift_docker_facts : Set docker facts ------------------------------- 4.42s
          /usr/share/ansible/openshift-ansible/roles/openshift_docker_facts/tasks/main.yml:2
          Gather Cluster facts and set is_containerized if needed ----------------- 3.18s
          /usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml:126
          Ensure openshift-ansible installer package deps are installed ----------- 1.92s
          /usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml:91
          openshift_prometheus : Set alert and prometheus secrets ----------------- 1.41s
          /usr/share/ansible/openshift-ansible/roles/openshift_prometheus/tasks/install_prometheus.yaml:12
          Gathering Facts --------------------------------------------------------- 1.05s
           ------------------------------------------------------------------------------
          openshift_sanitize_inventory : Check for usage of deprecated variables --- 0.91s
          /usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/deprecations.yml:3
          openshift_prometheus : create prometheus serviceaccount ----------------- 0.81s
          /usr/share/ansible/openshift-ansible/roles/openshift_prometheus/tasks/install_prometheus.yaml:25
          openshift_prometheus : Add prometheus project --------------------------- 0.76s
          /usr/share/ansible/openshift-ansible/roles/openshift_prometheus/tasks/install_prometheus.yaml:4
          Gathering Facts --------------------------------------------------------- 0.74s
           ------------------------------------------------------------------------------
          Gathering Facts --------------------------------------------------------- 0.66s
           ------------------------------------------------------------------------------
          Gathering Facts --------------------------------------------------------- 0.62s
           ------------------------------------------------------------------------------
          Gathering Facts --------------------------------------------------------- 0.61s
           ------------------------------------------------------------------------------
          openshift_repos : refresh cache ----------------------------------------- 0.59s
          /usr/share/ansible/openshift-ansible/roles/openshift_repos/handlers/main.yml:2
          openshift_repos : Ensure libselinux-python is installed ----------------- 0.45s
          /usr/share/ansible/openshift-ansible/roles/openshift_repos/tasks/main.yaml:10 -
          openshift_sanitize_inventory : conditional_set_fact --------------------- 0.44s
          /usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/__deprecations_logging.yml:5
          openshift_prometheus : annotate serviceaccount -------------------------- 0.43s
          /usr/share/ansible/openshift-ansible/roles/openshift_prometheus/tasks/install_prometheus.yaml:40
          openshift_sanitize_inventory : conditional_set_fact --------------------- 0.37s
          /usr/share/ansible/openshift-ansible/roles/openshift_sanitize_inventory/tasks/__deprecations_metrics.yml:5
          openshift_repos : Remove openshift_additional.repo file ----------------- 0.36s
          /usr/share/ansible/openshift-ansible/roles/openshift_repos/tasks/main.yaml:13 -
          Detecting Operating System from ostree_booted --------------------------- 0.32s
          /usr/share/ansible/openshift-ansible/playbooks/common/openshift-cluster/initialize_facts.yml:20
          openshift_prometheus : Create templates subdirectory -------------------- 0.26s
          /usr/share/ansible/openshift-ansible/roles/openshift_prometheus/tasks/main.yaml:16
          command terminated with exit code 2


Submit a correction or amendment below (click here to make a fresh posting)

Expected results:


Additional info:

Comment 1 Peter Ruan 2017-11-14 00:55:23 UTC

*** This bug has been marked as a duplicate of bug 1508310 ***