Skip to content

Commit

Permalink
Merge pull request #18 from hos7ein/master
Browse files Browse the repository at this point in the history
Add supporting of ubuntu hosts
  • Loading branch information
unixsurfer authored Oct 28, 2018
2 parents 3e5732b + d5ac5ec commit d777ac4
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 41 deletions.
2 changes: 1 addition & 1 deletion contrib/ansible-playbook/hosts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[haproxy-server]
[haproxy-servers]
10.10.22.70
32 changes: 11 additions & 21 deletions contrib/ansible-playbook/main-playbook.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
- name: Installation haproxystats on CentOS 7.x Server
hosts: haproxy-server
remote_user: root
roles:
- name: install dependency packages
role: roles/install-dependency-package

- name: install haproxystats
role: roles/install-haproxystats

- name: create new user
role: roles/create-newuser

- name: permission setting
role: roles/haproxy-socket-dir-permission

- name: haproxystats systemd config file
role: roles/systemd-files

- name: haproxystats config file
role: roles/haproxystats-config-file
# Installation haproxystats
- hosts: haproxy-servers
remote_user: root
gather_facts: False
roles:
- install-dependency-package
- install-haproxystats
- create-newuser
- haproxy-socket-dir-permission
- systemd-files
- haproxystats-config-file
4 changes: 2 additions & 2 deletions contrib/ansible-playbook/roles/create-newuser/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
- name: create haproxystats group
- name: Create haproxystats group
group:
name: haproxystats
state: present

- name : create new user for haproxystats service and add to haproxystats and haproxy group
- name : Create new user for haproxystats service and add to haproxystats and haproxy group
user:
name: haproxystats
group: haproxystats
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: set permission for haproxy socket directory
- name: Set permission for haproxy socket directory
file:
path: "{{ haproxy_socket_dir }}"
state: directory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
- name: make haproxystats config file
- name: Make haproxystats config file
template:
src: haproxystats.conf.j2
dest: /etc/haproxystats.conf
backup: yes

Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
---
- name : install or update epel repo
- name: Check out distribution and Install python version 2 on Ubuntu hosts
raw: DISTRO=$(awk '/^ID=/' /etc/*-release | awk -F'=' '{ print tolower($2) }') && if [ "$DISTRO" == "ubuntu" ] ; then apt-get -y update && apt-get install -y python-minimal; fi

- name: enable gather_facts
setup:

#task on CentOS or RHEL distribution
- name: Install or update EPEL repo
yum: name=epel-release state=latest
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'

- name : install python 3.4 and pip 3 packages
- name: Install python 3.4 and pip3 packages
yum:
pkg: "{{ item }}"
name: "{{ packages }}"
state: latest
with_items:
vars:
packages:
- python34
- python34-pip
- gcc
- gcc-c++
- python34-devel
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'

#task on Debian or Ubuntu distribution
- name: Install python 3 and pip3 packages
apt:
name: "{{ packages }}"
state: latest
vars:
packages:
- python3
- python3-pip
- python3-setuptools
- python-setuptools
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
26 changes: 24 additions & 2 deletions contrib/ansible-playbook/roles/install-haproxystats/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
---
- name : install haproxystats with pip 3
- name: Update setuptools by pip3
pip:
name: haproxystats
name:
- setuptools
state: latest
executable: pip3


- name: Install haproxystats by pip3
pip:
name:
- pbr
- pandas
- haproxystats
state: latest
executable: pip3
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'


- name: Install haproxystats by pip3
pip:
name:
- haproxystats
state: latest
executable: pip3
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
4 changes: 2 additions & 2 deletions contrib/ansible-playbook/roles/systemd-files/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
- name: make haproxystats-pull systemd file
- name: Make haproxystats-pull systemd file
template:
src: haproxystats-pull.service.j2
dest: /etc/systemd/system/haproxystats-pull.service
backup: yes

- name: make haproxystats-process systemd file
- name: Make haproxystats-process systemd file
template:
src: haproxystats-process.service.j2
dest: /etc/systemd/system/haproxystats-process.service
Expand Down

0 comments on commit d777ac4

Please sign in to comment.