Skip to content

Commit

Permalink
Initial IBMi playbook
Browse files Browse the repository at this point in the history
Add new IBM i system

Misc preparation for IBM i

Add ccache dependency

Split ibmi packages into separate lines for readability

Restructure os condition for readability

Remove QSECOFR IBM i RPM Repo from bootstrap task

Get rid of IBM i manual steps for bootstrap

Add libstdc++-devel

set yum backend
  • Loading branch information
George Adams authored and sam-github committed Nov 27, 2019
1 parent e451717 commit 772a31d
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 11 deletions.
4 changes: 4 additions & 0 deletions ansible/MANUAL_STEPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ to
```bash
sudo systemsetup -setremotelogin on
```

## IBMi

Ansible 2.7.6 is required.
4 changes: 4 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ ansible_python_interpreter = /usr/local/bin/python
[hosts:fedora30]
ansible_python_interpreter = /usr/bin/python3

[hosts:iinthecloud]
ansible_become = false
ansible_python_interpreter = /QOpenSys/pkgs/bin/python2

[hosts:marist]
ansible_become = false
ansible_python_interpreter = /NODEJS2/python-2017-04-12-py27/python27/bin/python
Expand Down
3 changes: 3 additions & 0 deletions ansible/host_vars/test-iinthecloud-ibmi72-ppc64_be-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
secret: "SECRET"
server_jobs: "4"
5 changes: 5 additions & 0 deletions ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ hosts:
centos7-ppc64_le-1: {ip: 140.211.168.193, user: centos}
centos7-ppc64_le-2: {ip: 140.211.168.244, user: centos}

- iinthecloud:
ibmi72-ppc64_be-1: {ip: 65.183.160.52, user: nodejs}
ibmi72-ppc64_be-2: {ip: 65.183.160.59, user: nodejs}
ibmi72-ppc64_be-2: {ip: 65.183.160.62, user: nodejs}

- rackspace:
centos7-x64-1: {ip: 119.9.27.82}
debian8-x64-1: {ip: 23.253.109.216}
Expand Down
2 changes: 1 addition & 1 deletion ansible/playbooks/jenkins/worker/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
- "!test-softlayer-ubuntu1604-x64-1"
tasks:
- name: remove node and npm packages
when: not os|startswith("win") and not os|startswith("zos")
when: not os|startswith("win") and not os|startswith("zos") and not os|startswith("ibmi") and os != "centos5"
package:
name: "{{ package }}"
state: absent
Expand Down
2 changes: 1 addition & 1 deletion ansible/plugins/inventory/nodejs_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
'provider': ('azure', 'digitalocean', 'joyent', 'ibm', 'linuxonecc',
'macstadium', 'marist', 'mininodes', 'msft', 'osuosl',
'rackspace', 'requireio', 'scaleway', 'softlayer', 'voxer',
'packetnet', 'nearform')
'packetnet', 'nearform', 'iinthecloud')
}
DECRYPT_TOOL = "gpg"
INVENTORY_FILENAME = "inventory.yml"
Expand Down
15 changes: 13 additions & 2 deletions ansible/roles/baselayout/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

- name: set hostname
when: not os|startswith("smartos") and not os|startswith("zos")
and not os|startswith("macos") and not os|startswith("aix")
and not os|startswith("macos") and not os|startswith("aix") and not os|startswith("ibmi")
hostname: name="{{ safe_hostname }}"

- name: Set hostname to inventory_hostname macOS
Expand Down Expand Up @@ -72,7 +72,7 @@
state: absent

- name: install packages
when: not os|startswith("zos") and not os|startswith("macos")
when: not os|startswith("zos") and not os|startswith("macos") and not os|startswith("ibmi")
package: name="{{ package }}" state=present
loop_control:
loop_var: package
Expand All @@ -82,6 +82,17 @@
- "{{ packages[os|stripversion]|default('[]') }}"
- "{{ common_packages|default('[]') }}"

- name: install packages IBMi
when: os|startswith("ibmi")
yum: name="{{ package }}" state=present use_backend=yum
loop_control:
loop_var: package
with_items:
# ansible doesn't like empty lists
- "{{ packages[os]|default('[]') }}"
- "{{ packages[os|stripversion]|default('[]') }}"
- "{{ common_packages|default('[]') }}"

- name: install packages (macos)
when: os|startswith("macos")
become_user: administrator
Expand Down
14 changes: 14 additions & 0 deletions ansible/roles/baselayout/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ packages: {
'gcc-c++,sudo',
],

ibmi: [
'gcc',
'gcc-cplusplus',
'gcc-cpp',
'ccache',
'sed-gnu',
'coreutils-gnu',
'zlib-devel',
'python2-pip',
'git',
'ca-certificates-mozilla',
'libstdcplusplus-devel',
],

debian7: [
'gcc-4.8,g++-4.8,sudo',
],
Expand Down
6 changes: 6 additions & 0 deletions ansible/roles/java-base/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
register: java_exists
when: os|startswith("aix")

- name: check if java is installed IBMi
stat:
path: /QOpenSys/QIBM/ProdDava/JavaVM/jdk80/64bit/bin/java
register: java_exists
when: os|startswith("ibmi")

- name: download java AIX
get_url:
url: https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u192-b12/OpenJDK8U-jre_ppc64_aix_hotspot_8u192b12.tar.gz
Expand Down
63 changes: 59 additions & 4 deletions ansible/roles/jenkins-worker/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
when: jobs_env is undefined

- name: create group
when: not os|startswith("zos")
when: not os|startswith("zos") and not os|startswith("ibmi")
group: name="{{ server_user }}"

- name: User | create file system on larger disk
Expand All @@ -43,12 +43,17 @@
when: "'rhel72-s390x' in inventory_hostname"

- name: create user
when: "not os|startswith('zos') and not 'rhel72-s390x' in inventory_hostname"
when: "not os|startswith('zos') and not os|startswith('ibmi') and not 'rhel72-s390x' in inventory_hostname"
user:
name: "{{ server_user }}"
group: "{{ server_user }}"
shell: "{{ bash_path[os|stripversion]|default('/bin/bash') }}"

- name: create user for ibmi
when: os|startswith("ibmi")
command: "/QOpenSys/usr/bin/system 'CRTUSRPRF USRPRF({{ server_user }}) PASSWORD(*none)'"
ignore_errors: true

- name: create user for rhel72-s390x
user:
name: "{{ server_user }}"
Expand Down Expand Up @@ -86,7 +91,7 @@
when: "'rhel72-s390x' in inventory_hostname"

- name: add ::1 to /etc/hosts for ipv6 compat
when: not os|startswith("zos")
when: not os|startswith("zos") and not os|startswith("ibmi")
lineinfile:
dest: /etc/hosts
state: present
Expand All @@ -96,12 +101,20 @@
file: path="{{ home }}/{{ server_user }}/tmp" state=directory

- name: set NODE_TEST_DIR permission and owner
when: not os|startswith("ibmi")
file:
path: "{{ home }}/{{ server_user }}/tmp"
owner: "{{ server_user }}"
group: "{{ server_user }}"
mode: 0755

- name: set NODE_TEST_DIR permission and owner IBMi
when: os|startswith("ibmi")
file:
path: "{{ home }}/{{ server_user }}/tmp"
owner: "{{ server_user }}"
mode: 0755

- name: run raspberry pi jenkins-worker setup
when: "inventory_hostname|regex_search('-arm(v6l|v7l|64)_pi')"
include: "{{ role_path }}/tasks/partials/raspberry-pi.yml"
Expand Down Expand Up @@ -148,6 +161,44 @@
command: systemctl restart iptables
when: "'rhel72-s390x' in inventory_hostname"

- name: firewalld | allow ipv4 multicast traffic
command: firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -m pkttype --pkt-type multicast -j ACCEPT
when: "'fedora27-x64' in inventory_hostname"

- name: firewalld | allow ipv6 multicast traffic
command: firewall-cmd --permanent --direct --add-rule ipv6 filter INPUT 0 -m pkttype --pkt-type multicast -j ACCEPT
when: "'fedora27-x64' in inventory_hostname"

- name: firewalld | restart so rules take effect
command: systemctl restart firewalld
when: "'fedora27-x64' in inventory_hostname"

- name: Check if SU is installed on IBMi
when: os|startswith("ibmi")
stat:
path: /QOpenSys/pkgs/bin/su
register: su_exists

- name: git clone su on ibmi
git:
repo: https://github.com/ThePrez/IBMiOSS-utils.git
dest: /tmp/IBMiOSS-utils
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: copy su into /QOpenSys/pkgs/bin IBMi
copy:
src: /tmp/IBMiOSS-utils/su
dest: /QOpenSys/pkgs/bin/su
remote_src: true
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: copy su-setup into /QOpenSys/pkgs/bin IBMi
copy:
src: /tmp/IBMiOSS-utils/su-setup
dest: /QOpenSys/pkgs/bin/su-setup
remote_src: true
when: su_exists.stat.exists == False and os|startswith("ibmi")

- name: download slave.jar
when: not os|startswith("zos")
get_url:
Expand Down Expand Up @@ -277,7 +328,11 @@
name: java-base

- name: enable jenkins at startup - general
when: not os|startswith("zos") and not os|startswith("macos") and not os|startswith("aix")
when:
- not os|startswith("aix")
- not os|startswith("ibmi")
- not os|startswith("macos")
- not os|startswith("zos")
service: name=jenkins state=restarted enabled=yes

- name: Unload org.nodejs.osx.jenkins.plist from launchctl
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

#
# install tap2junit ibmi
#

- name: install tap2junit
pip: name=tap2junit state=present
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
#

- name: install tap2junit
pip: name=tap2junit state=present
pip: name=tap2junit state=present
15 changes: 15 additions & 0 deletions ansible/roles/jenkins-worker/templates/ibmi_start.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

su -s - iojs <<'EOF'
export PATH=/QOpenSys/pkgs/lib/ccache:/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin
export HOME={{ home }}/{{ server_user }}
export NODE_COMMON_PIPE="$HOME/test.pipe"
export NODE_TEST_DIR="$HOME/tmp"
export JOBS=4
export OSTYPE=ibmi
{{ java_path[os] }} -Xmx{{ server_ram|default('128m') }} \
-jar {{ home }}/{{ server_user }}/slave.jar -secret {{ secret }} \
-jnlpUrl {{ jenkins_url }}/computer/{{ inventory_hostname }}/slave-agent.jnlp >{{ home }}/{{ server_user }}/jenkins.log 2>&1 &
EOF
6 changes: 6 additions & 0 deletions ansible/roles/jenkins-worker/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ init: {
centos6: 'centos6',
debian: 'debian7',
freebsd: 'freebsd',
ibmi: 'ibmi72',
macos: 'macos',
rhel72: 'rhel72',
systemd: ['centos7', 'debian8', 'debian9', 'fedora', 'ubuntu1604', 'ubuntu1804'],
Expand Down Expand Up @@ -69,6 +70,10 @@ jenkins_init: {
dest: '{{ home }}/{{ server_user }}/start.sh',
src: 'zos_start.j2'
},
ibmi: {
dest: '{{ home }}/{{ server_user }}/start.sh',
src: 'ibmi_start.j2'
},
}

# if you fail here, it means it cant map your os or os family to a init system
Expand All @@ -86,6 +91,7 @@ needs_monit: [
java_path: {
'aix71': '/home/iojs/jdk8u192-b12-jre/bin/java',
'aix72': '/home/iojs/jdk8u192-b12-jre/bin/java',
'ibmi72': '/QOpenSys/QIBM/ProdDava/JavaVM/jdk80/64bit/bin/java',
'macos10.10': 'java',
'macos10.11': 'java',
'macos10.12': 'java',
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/package-upgrade/tasks/partials/yum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
#

- name: upgrade installed packages
yum: name=* state=latest
yum: name=* state=latest use_backend=yum
2 changes: 1 addition & 1 deletion ansible/roles/package-upgrade/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

pm: {
'yum': ['centos', 'rhel72', 'aix'],
'yum': ['centos', 'rhel72', 'aix', 'ibmi'],
'apt': ['debian', 'ubuntu'],
'dnf': 'fedora',
'pkg': 'freebsd',
Expand Down

0 comments on commit 772a31d

Please sign in to comment.