rajops

jenkins.yml

Mar 10th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.90 KB | None | 0 0
  1. Hi,
  2.  
  3. I was trying to deploy jenkins using ansible playbooks as a part of learning and I was using "get_url" module to "add the repository key to the system (remote machine)" but when I execute its throws me an error which is
  4. >>>>>>>>>. HTTP Error 400: Bad Request", "state": "absent", "status_code": 400, "url<<<<<
  5. Please suggest what to do with this error.
  6.  
  7. Anisble script:
  8. --
  9.  
  10. - name: deploying jenkins on target machine
  11.   hosts: dbU1
  12.   gather_facts: yes
  13.   #become_user: root
  14.   #become_method: root
  15.  
  16.   tasks:
  17.     - name: update the apt repo
  18.       apt:
  19.         update_cache: yes
  20.         cache_valid_time: 8600
  21.       become: yes
  22.  
  23.       #when: ansible_facts['os_family'] == "Debian"
  24.  
  25.     - name: Installing the dependience on dbU1
  26.       apt:
  27.         name: "{{ item }}"
  28.         state: latest
  29.       with_items:
  30.         - openjdk-8-jdk
  31.          - wget
  32.       become: yes
  33.  
  34.     - name: add the repository key to the system dbU1
  35.       get_url:
  36.          url: https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add
  37.          dest: var/lib/
  38.  
  39.  
  40.  
  41. [ansadmctrl@ip-xxx-xx-xx-xx ex3]$ ansible-playbook -i inven-dev jenkins.yml -K
  42. SUDO password:
  43.  
  44. PLAY [deploying jenkins on target machine (Web & db)] ************************************************************************************************
  45.  
  46. TASK [Gathering Facts] *******************************************************************************************************************************
  47. ok: [dbU1]
  48.  
  49. TASK [update the apt repo] ***************************************************************************************************************************
  50. ok: [dbU1]
  51.  
  52. TASK [Installing the prerequisites on dbU1] **********************************************************************************************************
  53. [DEPRECATION WARNING]: Invoking "apt" only once while using a loop via squash_actions is deprecated. Instead of using a loop to supply multiple items
  54.  and specifying `name: "{{ item }}"`, please use `name: ['openjdk-8-jdk', 'wget']` and remove the loop. This feature will be removed in version 2.11.
  55.  Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
  56. ok: [dbU1] => (item=[u'openjdk-8-jdk', u'wget'])
  57.  
  58. TASK [add the repository key to the system dbU1] *****************************************************************************************************
  59. fatal: [dbU1]: FAILED! => {"changed": false, "dest": "var/lib/", "msg": "Request failed", "response": "HTTP Error 400: Bad Request", "state": "absent", "status_code": 400, "url": "https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add"}
  60.     to retry, use: --limit @/home/ansadmctrl/ansible/ex3/jenkins.retry
  61.  
  62. PLAY RECAP *******************************************************************************************************************************************
  63. dbU1                       : ok=3    changed=0    unreachable=0    failed=1
Add Comment
Please, Sign In to add comment