added tasks

This commit is contained in:
Andrew Smith 2018-05-14 15:58:18 -04:00
parent e83fe9fb34
commit 7cfe3675f2
17 changed files with 465 additions and 56 deletions

View File

@ -1,57 +1,33 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
galaxy_info: galaxy_info:
author: your name author: Andy Smith
description: your description description: This role installs and configures the qpid-dispatch-router
company: your company (optional) license: Apache
min_ansible_version: 2.3
# If the issue tracker for your role is not on github, uncomment the platforms:
# next line and provide a value - name: EL
# issue_tracker_url: http://example.com/issue/tracker versions:
- 7
# Some suggested licenses: - name: Ubuntu
# - BSD (default) versions:
# - MIT - trusty
# - GPLv2 - xenial
# - GPLv3 categories:
# - Apache - messaging
# - CC-BY - cloud
license: license (GPLv2, CC-BY, etc) - openstack
min_ansible_version: 1.2
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If Travis integration is configured, only notifications for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# platforms is a list of platforms, and each platform has a name and a list of versions.
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: [] dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@ -1,2 +1,34 @@
--- ---
# tasks file for ansible-qdrouterd # Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather variables for each operating system
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
- "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
- "{{ ansible_distribution | lower }}.yml"
- "{{ ansible_os_family | lower }}.yml"
tags:
- always
- include: qdrouterd_pre_install.yml
- include: qdrouterd_install.yml
static: no
- include: qdrouterd_post_install.yml

View File

@ -0,0 +1,34 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- include: "qdrouterd_install_{{ ansible_pkg_mgr }}.yml"
tags:
- qdrouterd-apt-packages
- qdrouterd-yum-packages
- qdrouterd_server-install
- name: Reload the systemd daemon
systemd:
daemon_reload: yes
when:
- install_qdrouterd | changed
tags:
- qdrouterd-apt-packages
- qdrouterd-yum-packages
- qdrouterd_server-install
- include: qdrouterd_started.yml
tags:
- qdrouterd_server-config

View File

@ -0,0 +1,22 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Install Qpid Dispatch Router (qdrouterd) packages
apt:
name: "{{ qdrouterd_distro_packages }}"
state: "{{ qdrouterd_server_package_state }}"
register: install_qdrouterd
tags:
- qdrouterd-apt-packages

View File

@ -0,0 +1,48 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Check if EPEL repo is already configured.
stat: path={{ epel_repofile_path }}
register: epel_repofile_result
- name: Install EPEL repo.
yum:
name: "{{ epel_repo_url }}"
state: present
register: result
when: not epel_repofile_result.stat.exists
- name: Import EPEL GPG key
rpm_key:
key: "{{ epel_repo_gpg_key_url }}"
state: present
when: not epel_repofile_result.stat.exists
- name: Ensure yum-config-manager is installed
package:
name: yum-utils
state: present
- name: Ensure that EPEL is enabled
shell: yum-config-manager --enable epel
- name: Install Qpid Dispatch Router (qdrouterd) packages
yum:
name: "{{ qdrouterd_distro_packages }}"
state: "{{ qdrouterd_package_state }}"
enablerepo: epel
register: install_qdrouterd
tags:
- qdrouterd-yum-packages

View File

@ -0,0 +1,31 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create qdrouterd config
register: qdrouterd_config_changed
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "{{ qdrouterd_service_name }}"
mode: "0600"
with_items:
- { src: "qdrouterd.conf.j2", dest: "{{ qdrouterd_etc_conf_file }}" }
- { src: "qdrouterd-sasl.conf.j2", dest: "{{ qdrouterd_sasl_conf_file }}" }
tags:
- qdrouterd-config
- include: qdrouterd_restart.yml
static: no
when: qdrouterd_config_changed|changed

View File

@ -0,0 +1,44 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create the local directories
file:
path: "/etc/qpid-dispatch/"
state: "directory"
group: "root"
owner: "root"
mode: "0755"
tags:
- qdrouterd-config
- name: Create the log directory
file:
path: "/var/lib/qdrouterd/"
state: "directory"
group: "qdrouterd"
owner: "qdrouterd"
recurse: true
tags:
- qdrouterd-config
- name: Create the log directory
file:
path: "/var/log/qdrouterd/"
state: "directory"
group: "qdrouterd"
owner: "qdrouterd"
recurse: true
tags:
- qdrouterd-config

View File

@ -0,0 +1,19 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- include: qdrouterd_stopped.yml
- include: qdrouterd_started.yml

View File

@ -0,0 +1,24 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure Qpid Dispatch Router is started
service:
name: "{{ qdrouterd_service_name }}"
state: started
enabled: yes
tags:
- qdrouterd-server-started
- qdrouterd-upgrade
- qdrouterd-start

View File

@ -0,0 +1,24 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure Qpid Dispatch Router is stopped
service:
name: "{{ qdrouterd_service_name }}"
state: stopped
failed_when: false
tags:
- qdrouterd-server-stopped
- qdrouterd-upgrade
- qdrouterd-stop

View File

@ -0,0 +1,4 @@
pwcheck_method: auxprop
auxprop_plugin: sasldb
sasldb_path: /var/lib/qdrouterd/qdrouterd.sasldb
mech_list: ANONYMOUS PLAIN

View File

@ -0,0 +1,58 @@
router {
mode: standalone
id: Router.A
workerThreads: 4
saslConfigPath: /etc/sasl2
saslConfigName: qdrouterd
}
listener {
host: {{ ansible_hostname }}
port: {{ qdrouterd_port }}
role: normal
authenticatePeer: no
}
address {
prefix: unicast
distribution: closest
}
address {
prefix: exclusive
distribution: closest
}
address {
prefix: broadcast
distribution: multicast
}
address {
prefix: openstack.org/om/rpc/multicast
distribution: multicast
}
address {
prefix: openstack.org/om/rpc/unicast
distribution: closest
}
address {
prefix: openstack.org/om/rpc/anycast
distribution: balanced
}
address {
prefix: openstack.org/om/notify/multicast
distribution: multicast
}
address {
prefix: openstack.org/om/notify/unicast
distribution: closest
}
address {
prefix: openstack.org/om/notify/anycast
distribution: balanced
}
log {
module: DEFAULT
enable: info+
output: /var/log/qdrouterd/qdrouterd.log
}

View File

@ -0,0 +1,29 @@
{
"command": "/usr/sbin/qdrouterd",
"config_files": [
{
"source": "{{ container_config_directory }}/qdrouterd.conf",
"dest": "/etc/qpid-dispatch/qdrouterd.conf",
"owner": "qdrouterd",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/qdrouterd-sasl.conf",
"dest": "/etc/sasl2/qdrouterd.conf",
"owner": "qdrouterd",
"perm": "0600"
}
],
"permissions": [
{
"path": "/var/lib/qdrouterd",
"owner": "qdrouterd:qdrouterd",
"recurse": true
},
{
"path": "/var/log/kolla/qdrouterd",
"owner": "qdrouterd:qdrouterd",
"recurse": true
}
]
}

View File

@ -0,0 +1,4 @@
# {{ ansible_managed }}
[Service]
Restart=on-failure
RestartSec=2

View File

@ -1,2 +1,3 @@
--- ---
# vars file for ansible-qdrouterd # vars file for ansible-qdrouterd
qdrouterd_port: 5672

30
vars/redhat.yml Normal file
View File

@ -0,0 +1,30 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
qdrouterd_distro_packages:
- python-qpid-proton
- cyrus-sasl-lib
- cyrus-sasl-plain
- qpid-dispatch-router
- qpid-dispatch-tools
qdrouterd_package_state: "latest"
qdrouterd_etc_conf_file: "/etc/qpid-dispatch/qdrouterd.conf"
qdrouterd_sasl_conf_file: "/etc/sasl2/qdrouterd.conf"
qdrouterd_service_name: "qdrouterd"
epel_repo_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
epel_repo_gpg_key_url: "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"
epel_repofile_path: "/etc/yum.repos.d/epel.repo"

29
vars/ubuntu.yml Normal file
View File

@ -0,0 +1,29 @@
---
# Copyright 2018, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
qdrouterd_distro_packages:
- python-qpid-proton
- sasl2-bin
- libpython-2.2
- qdrouterd
qdrouterd_package_name: "qdrouterd"
qdrouterd_service_name: "qdrouterd"
qdrouterd_etc_conf_file: "/etc/qpid-dispatch/qdrouterd.conf"
# repo details for qpid ppa
qdrouterd_ppa_repo: "ppa:qpid/released"
qdrouterd_ppa_keyid: 4096R/4D8EB5FDA37AB55F41A135203BF88A0C6A770882
qdrouterd_ppa_keyserver: "keyserver.ubuntu.com"