Guest User

Untitled

a guest
Mar 18th, 2017
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.79 KB | None | 0 0
  1. ---
  2. - hosts: web-suse
  3.   become: true
  4.  
  5.   vars:
  6.     user: hybris
  7.     support_user: support
  8.     download_url: http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.tar.gz
  9.     download_folder: /opt
  10.     java_name: "{{download_folder}}/jdk1.8.0_05"
  11.     java_archive: "{{download_folder}}/jdk-8u5-linux-x64.tar.gz"
  12.  
  13.   tasks:
  14.     - zypper: name=apache2 state=present
  15.  
  16.     - zypper: name=git-core state=present
  17.  
  18.     - group:
  19.         name: "{{user}}"
  20.         state: present
  21.  
  22.     - name: Allow {{user}} group to have passwordless sudo
  23.       lineinfile:
  24.         dest: /etc/sudoers
  25.         state: present
  26.         regexp: '^%{{user}}'
  27.         line: '%{{user}} ALL=(ALL) NOPASSWD: ALL'
  28.         validate: 'visudo -cf %s'
  29.  
  30.     - user:
  31.         name: "{{user}}"
  32.         shell: /bin/bash
  33.         group: "{{user}}"
  34.         groups: "root"
  35.         append: yes
  36.    
  37.     - group:
  38.         name: "{{support_user}}"
  39.         state: present
  40.  
  41.     - user:
  42.         name: "{{support_user}}"
  43.         shell: /bin/bash
  44.         groups: "{{support_user}}"
  45.         append: yes
  46.  
  47.     #java installation--------
  48.  
  49.     - name: Download Java
  50.       command: "wget -q -O {{java_archive}} --no-check-certificate --no-cookies --header 'Cookie: oraclelicense=accept-securebackup-cookie' {{download_url}} creates={{java_archive}}"
  51.  
  52.     - name: Unpack archive
  53.       command: "tar -zxf {{java_archive}} -C {{download_folder}} creates={{java_name}}"
  54.  
  55.     - name: Fix ownership
  56.       file: state=directory path={{java_name}} owner={{user}} group=root recurse=yes
  57.  
  58.     - name: Make Java available for system
  59.       command: 'alternatives --install "/usr/bin/java" "java" "{{java_name}}/bin/java" 2000'
  60.  
  61.     - name: Clean up
  62.       file: state=absent path={{java_archive}}
  63.  
  64.     #java installation done--------
Add Comment
Please, Sign In to add comment