[icinga-checkins] icinga.org: icinga2-ansible/master: Added Gentoo installation tasks in no-ui and classic-ui roles

git at icinga.org git at icinga.org
Wed Jul 6 13:48:54 CEST 2016


Module: icinga2-ansible
Branch: master
Commit: a6482e74f5c7650255defb379727640603272a6b
URL:    https://git.icinga.org/?p=icinga2-ansible.git;a=commit;h=a6482e74f5c7650255defb379727640603272a6b

Author: Daniel Kuehn <daniel at kuehn.se>
Date:   Thu Apr 28 10:16:26 2016 +0200

Added Gentoo installation tasks in no-ui and classic-ui roles

---

 icinga2-ansible-classic-ui/defaults/main.yml       |   15 ++++++
 .../tasks/icinga2_classic_ui_Gentoo_install.yml    |   51 ++++++++++++++++++++
 icinga2-ansible-classic-ui/tasks/main.yml          |    3 ++
 .../tasks/icinga2_Gentoo_install.yml               |    9 ++++
 icinga2-ansible-no-ui/tasks/main.yml               |    3 ++
 5 files changed, 81 insertions(+)

diff --git a/icinga2-ansible-classic-ui/defaults/main.yml b/icinga2-ansible-classic-ui/defaults/main.yml
index 263e186..fea8545 100644
--- a/icinga2-ansible-classic-ui/defaults/main.yml
+++ b/icinga2-ansible-classic-ui/defaults/main.yml
@@ -17,3 +17,18 @@ icinga2_classic_ui_rpm:
  - { package: "python-passlib" }
 
 htpasswd_rh: "/etc/icinga/passwd"
+
+# Vars for Gentoo OS Family
+icinga2_classic_ui_ebuilds:
+ - { package: "icinga" }
+ - { package: "passlib" }
+
+# Set which webserver to use, choice between apache2 and lighttpd, set to none if using
+# another webserver, but then you're on your own with configuring the webserver
+icinga2_classic_ui_webserver: 'none'
+
+# Set to file or directory, to tell the playbooks if your package.use is a file or 
+# directory
+icinga2_classic_ui_gentoo_package_use: 'file'
+
+htpasswd_gentoo: "/etc/icinga/htpasswd"
diff --git a/icinga2-ansible-classic-ui/tasks/icinga2_classic_ui_Gentoo_install.yml b/icinga2-ansible-classic-ui/tasks/icinga2_classic_ui_Gentoo_install.yml
new file mode 100644
index 0000000..024681c
--- /dev/null
+++ b/icinga2-ansible-classic-ui/tasks/icinga2_classic_ui_Gentoo_install.yml
@@ -0,0 +1,51 @@
+---
+- name: Set web USE-flag on Icinga to enable Classic UI
+  lineinfile: dest=/etc/portage/package.use
+              create=yes
+              line="net-analyzer/icinga web"
+              state=present
+  when: icinga2_classic_ui_gentoo_package_use == 'file'
+
+- name: Set web USE-flag on Icinga to enable Classic UI
+  lineinfile: dest=/etc/portage/package.use/icinga2-classic-ui
+              create=yes
+              line="net-analyzer/icinga web"
+              state=present
+  when: icinga2_classic_ui_gentoo_package_use == 'directory'
+
+- name: Set apache2 USE-flag on Icinga to enable apache2 configs installation
+  replace: dest=/etc/portage/package.use
+           regexp="(net-analyzer/icinga.*)"
+           replace="\1 apache2"
+  when: icinga2_classic_ui_gentoo_package_use == 'file' and icinga2_classic_ui_webserver == 'apache2'
+
+- name: Set web USE-flag on Icinga to enable lighttpd configs installation
+  replace: dest=/etc/portage/package.use/icinga2-classic-ui
+           regexp="(net-analyzer/icinga.*)"
+           replace="\1 lighttpd"
+  when: icinga2_classic_ui_gentoo_package_use == 'directory' and icinga2_classic_ui_webserver == 'lighttpd'
+
+- name: Install Icinga Classic UI on Gentoo OS family
+  portage: package={{ item.package }}
+           state=present
+  with_items: icinga2_classic_ui_ebuilds
+
+- name: Configure password for icingaadmin user
+  htpasswd: name=icingaadmin
+            state=present
+            path="{{ htpasswd_gentoo }}"
+            create=yes
+            password="{{ icinga2_classic_ui_passwd }}"
+
+- name: restart apache2
+  service: name=apache2
+           state=restarted
+  when: icinga2_classic_ui_webserver == 'apache2'
+
+- name: restart lighthttpd
+  service: name=apache2
+           state=restarted
+  when: icinga2_classic_ui_webserver == 'lighthttpd'
+
+- name: Icinga Classic UI Installation finished (Gentoo)
+  debug: msg="User icingaadmin and password {{ icinga2_classic_ui_passwd }} have been created. If you enabled apache2 or lighttpd USE-flags you can access it at http://IP/, otherwise you have to configure your webserver of choice yourself."
diff --git a/icinga2-ansible-classic-ui/tasks/main.yml b/icinga2-ansible-classic-ui/tasks/main.yml
index 6752035..5cfb98a 100644
--- a/icinga2-ansible-classic-ui/tasks/main.yml
+++ b/icinga2-ansible-classic-ui/tasks/main.yml
@@ -6,3 +6,6 @@
 
 - include: icinga2_classic_ui_RedHat_install.yml
   when: ansible_os_family == 'RedHat'
+
+- include: icinga2_classic_ui_Gentoo_install.yml
+  when: ansible_os_family == 'Gentoo'
diff --git a/icinga2-ansible-no-ui/tasks/icinga2_Gentoo_install.yml b/icinga2-ansible-no-ui/tasks/icinga2_Gentoo_install.yml
new file mode 100644
index 0000000..5080923
--- /dev/null
+++ b/icinga2-ansible-no-ui/tasks/icinga2_Gentoo_install.yml
@@ -0,0 +1,9 @@
+---
+- name: Install Icinga2 on Gentoo OS family
+  portage: package={{ item.package }} state=present
+  with_items: icinga2_pkg
+
+- name: Start Icinga2
+  service: name=icinga2
+           state=started
+           enabled=yes
diff --git a/icinga2-ansible-no-ui/tasks/main.yml b/icinga2-ansible-no-ui/tasks/main.yml
index e508de0..1f606ac 100644
--- a/icinga2-ansible-no-ui/tasks/main.yml
+++ b/icinga2-ansible-no-ui/tasks/main.yml
@@ -7,6 +7,9 @@
 - include: icinga2_RedHat_install.yml
   when: ansible_os_family == 'RedHat'
 
+- include: icinga2_Gentoo_install.yml
+  when: ansible_os_family == 'Gentoo'
+
 - include: icinga2_configure.yml
   tags: 
    - icinga2_configure



More information about the icinga-checkins mailing list