通过 Ansible 安装 Jenkins 时发现 Java 的版本不正确
Found incorrect version of Java while installing Jenkins via Ansible
需要你的帮助,当我尝试通过 Ansible playbook 安装 Jenkins 时 returns 以下问题
Extracting templates from packages: 100%
Found an incorrect Java version
Java version found:
java version "1.7.0_131"
OpenJDK Runtime Environment (IcedTea 2.6.9) (7u131-2.6.9-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
Aborting
invoke-rc.d: initscript jenkins, action "start" failed.
dpkg: error processing package jenkins (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
真不知道从何说起。谢谢
Jenkins 现在需要 Java 8,您需要在此之前向您的 Ansible Playbook 添加一个任务,以确保您得到 Java 8。
- name: Install jdk version 8
package:
name: openjdk-8-jdk
state: present
您可能还想将正确的 Java link 设置为 OS 默认值,以防您最终使用以下代码进行多个安装。
- name: Select openjdk 8 as system default java
alternatives:
name: java
path: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
如果您是 运行 来自角色的,则将其插入角色定义本身之前的 pre-tasks:
部分下。
你可以试试这个安装 java8:
- name: Ensure the webupd8 launchpad apt repository key is present
apt_key:
id: 0xC2518248EEA14886
keyserver: keyserver.ubuntu.com
state: present
- name: Add Oracle Java Repository
apt_repository:
repo: 'ppa:webupd8team/java'
- name: Accept Java 8 License
debconf:
name: 'oracle-java8-installer'
question: 'shared/accepted-oracle-license-v1-1'
value: 'true'
vtype: 'select'
- name: Install Oracle Java 8
apt:
name: {{item}}
state: latest
with_items:
- oracle-java8-installer
- ca-certificates
- oracle-java8-set-default
需要你的帮助,当我尝试通过 Ansible playbook 安装 Jenkins 时 returns 以下问题
Extracting templates from packages: 100%
Found an incorrect Java version
Java version found:
java version "1.7.0_131"
OpenJDK Runtime Environment (IcedTea 2.6.9) (7u131-2.6.9-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
Aborting
invoke-rc.d: initscript jenkins, action "start" failed.
dpkg: error processing package jenkins (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
真不知道从何说起。谢谢
Jenkins 现在需要 Java 8,您需要在此之前向您的 Ansible Playbook 添加一个任务,以确保您得到 Java 8。
- name: Install jdk version 8
package:
name: openjdk-8-jdk
state: present
您可能还想将正确的 Java link 设置为 OS 默认值,以防您最终使用以下代码进行多个安装。
- name: Select openjdk 8 as system default java
alternatives:
name: java
path: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
如果您是 运行 来自角色的,则将其插入角色定义本身之前的 pre-tasks:
部分下。
你可以试试这个安装 java8:
- name: Ensure the webupd8 launchpad apt repository key is present
apt_key:
id: 0xC2518248EEA14886
keyserver: keyserver.ubuntu.com
state: present
- name: Add Oracle Java Repository
apt_repository:
repo: 'ppa:webupd8team/java'
- name: Accept Java 8 License
debconf:
name: 'oracle-java8-installer'
question: 'shared/accepted-oracle-license-v1-1'
value: 'true'
vtype: 'select'
- name: Install Oracle Java 8
apt:
name: {{item}}
state: latest
with_items:
- oracle-java8-installer
- ca-certificates
- oracle-java8-set-default