Skip to content

Commit

Permalink
ensuring rundeck installs across various versions and OSs, includes f…
Browse files Browse the repository at this point in the history
…ixes for #23 and #14
  • Loading branch information
mat-green committed Feb 11, 2017
1 parent 0864fe1 commit 22315f8
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 52 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@

# Vagrant generated files and folders
.vagrant
*.log

# Ansible files
*.retry
31 changes: 15 additions & 16 deletions tasks/install_debian.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
# Debian based OS
- name: Rundeck | Install supporting packages
- name: Debian | Install supporting packages
apt:
name: "{{ item }}"
state: present
become: yes
with_items:
- python-pip
- python-setuptools

- name: Rundeck | Install supporting python packages
- name: Debian | Install supporting python packages
pip:
name: "{{ item }}"
state: present
become: yes
with_items:
- httplib2

- name: Rundeck | Add Bintray GPG key for rundeck repo
- name: Debian | Add Bintray GPG key for rundeck repo
apt_key:
id: 379CE192D401AB61
url: https://bintray.com/user/downloadSubjectPublicKey?username=bintray
Expand All @@ -25,7 +26,7 @@
- install
- packages

- name: Rundeck | Add Rundeck Build GPG key
- name: Debian | Add Debian Build GPG key
apt_key:
id: 85E9DBC74FCB329EDEDADD2E90770E1BE2D1065B
url: http://rundeck.org/keys/BUILD-GPG-KEY-Rundeck.org.key
Expand All @@ -34,20 +35,18 @@
- install
- packages

- name: Rundeck | Add Rundeck APT repository on Bintray
- name: Debian | Add Debian APT repository on Bintray
apt_repository:
repo: 'deb http://dl.bintray.com/rundeck/rundeck-deb /'
filename: rundeck
tags:
- rundeck
- install
- packages

- name: Rundeck | install from APT repository
- name: Debian | install from APT repository
apt:
name: rundeck
state: present
allow_unauthenticated: yes #FIXME: https://github.com/rundeck/rundeck/issues/93
notify:
- systemd daemon-reload
- restart rundeck
Expand All @@ -56,7 +55,7 @@
- install
- packages

- name: Rundeck | check upstart configuration exists
- name: Debian | check upstart configuration exists
register: upstart_config
stat:
path: /etc/init/rundeckd.conf
Expand All @@ -67,7 +66,7 @@
- install
- packages

- name: Rundeck | remove System V init.d script if upstart config exists
- name: Debian | remove System V init.d script if upstart config exists
file:
path: /etc/init.d/rundeckd
state: absent
Expand All @@ -77,7 +76,7 @@
- install
- packages

- name: Rundeck | add systemd service helper
- name: Debian | add systemd service helper
copy:
src: systemd/rundeck-start
dest: /usr/bin/rundeck-start
Expand All @@ -90,7 +89,7 @@
- install
- packages

- name: Rundeck | add systemd service unit
- name: Debian | add systemd service unit
copy:
src: systemd/rundeckd.service
dest: /etc/systemd/system/rundeckd.service
Expand All @@ -105,7 +104,7 @@
- install
- packages

- name: Rundeck | ensure service log directory has correct ownership
- name: Debian | ensure service log directory has correct ownership
file:
path: /var/log/rundeck
owner: rundeck
Expand All @@ -115,7 +114,7 @@
- install
- packages

- name: Rundeck | See if there are more log files
- name: Debian | See if there are more log files
find:
paths: /var/log/rundeck
file_type: file
Expand All @@ -126,13 +125,13 @@
- install
- packages

- name: Rundeck | ensure service log files have correct ownership
- name: Debian | ensure service log files have correct ownership
file:
path: "{{ item.path }}"
owner: rundeck
state: file
with_items:
"{{ rundeck_logfiles.files }}"
"{{ rundeck_logfiles.files|default([]) }}"
tags:
- rundeck
- install
Expand Down
4 changes: 2 additions & 2 deletions tasks/install_redhat.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# Redhat based OS
- name: Rundeck | get rundeck rpm
- name: Redhat | get rundeck rpm
yum:
name: http://repo.rundeck.org/latest.rpm
state: present
Expand All @@ -10,7 +10,7 @@
- install
- packages

- name: Rundeck | get rundeck rpm
- name: Redhat | get rundeck rpm
yum:
name: rundeck
state: present
Expand Down
17 changes: 12 additions & 5 deletions tasks/users.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Should ideally create user passwords dynamically like the following but failing:
- name: Rundeck | encode users password
shell: "java -cp {{ rundeck_jetty_jar }} org.eclipse.jetty.util.security.Password {{ item.name }} {{ item.password }} 2>&1 | grep MD5"
- name: Users | determine jetty jar
find:
paths: "/var/lib/rundeck/bootstrap/"
patterns: "^jetty-all-.*.jar$"
use_regex: True
register: rundeck_jetty_jar

- name: Users | encode users password
shell: "java -cp {{ rundeck_jetty_jar.files[0].path }} org.eclipse.jetty.util.security.Password {{ item.name }} {{ item.password }} 2>&1 | grep MD5"
become: True
register: rundeck_encoded_users
when: rundeck_users|length > 0
when: rundeck_jetty_jar|success and rundeck_users|length > 0
with_items: "{{ rundeck_users }}"

- name: Rundeck | update basic security to have users
- name: Users | update basic security to have users
template:
src: realm.properties.j2
dest: /etc/rundeck/realm.properties
owner: rundeck
group: rundeck
group: rundeck
when: rundeck_users|length > 0 and rundeck_encoded_users|success
notify:
- restart rundeck
Expand Down
8 changes: 1 addition & 7 deletions tests/default_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
- name: Bootstrap python
hosts: rundeck-servers
become: yes
gather_facts: no

tasks:
- name: Setup | Are we on Debian?
raw: 'lsb_release -si'
register: lsb_release

- name: Setup | Bootstrap on Debian
raw: 'apt-get update && apt-get --no-install-recommends -yq install python python-apt'
when: lsb_release.stdout == "Ubuntu\r\n" or lsb_release.stdout == "Debian\r\n"
when: ansible_os_family == "Ubuntu" or ansible_os_family == "Debian"

- name: test default values deployment
hosts: rundeck-servers
Expand Down
7 changes: 3 additions & 4 deletions tests/vagrant-centos65/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

IP_ADDRESS = "33.33.33.65"
IP_ADDRESS = "172.16.0.16"
HTTP_PORT = 8065
HTTPS_PORT = 8465

Expand Down Expand Up @@ -29,16 +29,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## Provision via ansible using the defaults:
config.vm.provision "ansible" do |ansible|
ansible.extra_vars = {
environment: "vagrant",
rundeck_domain: "localhost:8065",
rundeck_domain: "localhost:#{HTTP_PORT}",
java_packages: [ "java-1.7.0-openjdk" ]
}
ansible.groups = {
"rundeck-servers" => [ "default" ]
}
ansible.playbook = "../#{PLAYBOOK}"
ansible.host_key_checking = false
ansible.verbose = "v"
ansible.verbose = "vv"
# use ANSIBLE_KEEP_REMOTE_FILES=1 to debug execution
end
end
5 changes: 2 additions & 3 deletions tests/vagrant-centos70/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

IP_ADDRESS = "33.33.33.66"
IP_ADDRESS = "172.16.0.17"
HTTP_PORT = 8066
HTTPS_PORT = 8466

Expand Down Expand Up @@ -30,8 +30,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## Provision via ansible using the defaults:
config.vm.provision "ansible" do |ansible|
ansible.extra_vars = {
environment: "vagrant",
rundeck_domain: "localhost:8066",
rundeck_domain: "localhost:#{HTTP_PORT}",
java_packages: [ "java-1.7.0-openjdk" ]
}
ansible.groups = {
Expand Down
6 changes: 3 additions & 3 deletions tests/vagrant-precise64/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

IP_ADDRESS = "33.33.33.67"
IP_ADDRESS = "172.16.0.18"
HTTP_PORT = 8067
HTTPS_PORT = 8467

Expand Down Expand Up @@ -29,15 +29,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## Provision via ansible using the defaults:
config.vm.provision "ansible" do |ansible|
ansible.extra_vars = {
rundeck_domain: "localhost:8067",
rundeck_domain: "localhost:#{HTTP_PORT}",
java_packages: [ "openjdk-7-jre-headless" ]
}
ansible.groups = {
"rundeck-servers" => [ "default" ]
}
ansible.playbook = "../#{PLAYBOOK}"
ansible.host_key_checking = false
ansible.verbose = "vvvv"
ansible.verbose = "v"
# use ANSIBLE_KEEP_REMOTE_FILES=1 to debug execution
end
end
5 changes: 2 additions & 3 deletions tests/vagrant-trusty64/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

IP_ADDRESS = "33.33.33.68"
IP_ADDRESS = "172.16.0.19"
HTTP_PORT = 8068
HTTPS_PORT = 8468

Expand Down Expand Up @@ -29,8 +29,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## Provision via ansible using the defaults:
config.vm.provision "ansible" do |ansible|
ansible.extra_vars = {
environment: "vagrant",
rundeck_domain: "localhost:8068",
rundeck_domain: "localhost:#{HTTP_PORT}",
java_packages: [ "openjdk-7-jre-headless" ]
}
ansible.groups = {
Expand Down
21 changes: 13 additions & 8 deletions tests/vagrant-xenial64/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

IP_ADDRESS = "33.33.33.68"
HTTP_PORT = 8068
HTTPS_PORT = 8468
# Install the following if boxes fails to boot:
# vagrant plugin install vagrant-vbguest


IP_ADDRESS = "172.16.0.20"
HTTP_PORT = 8069
HTTPS_PORT = 8469

PLAYBOOK = ENV['PLAYBOOK'] || 'default_test.yml'

Expand All @@ -13,24 +17,25 @@ VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/xenial64"
config.vm.box = "bento/ubuntu-16.04" # "boxcutter/ubuntu1604" # "ubuntu/xenial64" #

## identifier
config.vm.hostname = "vagrant-ansible-rundeck-xenial64"
## Network
config.vm.network "private_network", ip: IP_ADDRESS
config.vm.network "private_network", ip: IP_ADDRESS, auto_config: false
config.vm.network "forwarded_port", guest: 4440, host: HTTP_PORT # Web server
config.vm.network "forwarded_port", guest: 443, host: HTTPS_PORT # Secure web server
## virtual box specification
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
v.customize ["modifyvm", :id, "--memory", 1024]
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cableconnected1", "on"]
v.customize ["modifyvm", :id, "--nictype1", "virtio"]
end
## Provision via ansible using the defaults:
config.vm.provision "ansible" do |ansible|
ansible.extra_vars = {
environment: "vagrant",
rundeck_domain: "localhost:8068",
rundeck_domain: "localhost:#{HTTP_PORT}",
java_packages: [ "openjdk-8-jre-headless" ]
}
ansible.groups = {
Expand Down
1 change: 0 additions & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
# The following may be stable or change overtime - TBD
rundeck_jetty_jar: /var/lib/rundeck/bootstrap/jetty-all-7.6.0.v20120127.jar
rundeck_home_dir: /var/lib/rundeck
rundeck_conf_dir: /etc/rundeck
rundeck_user: rundeck
Expand Down

0 comments on commit 22315f8

Please sign in to comment.