From 5d8caea3ef6dab19cc696018a19758e28b017dff Mon Sep 17 00:00:00 2001 From: root Date: Sun, 22 Nov 2015 08:00:47 +0100 Subject: [PATCH] restructured inventory --- README/server_conf.spec | 4 ++ group_vars/{all => all/splunk_installation} | 9 +--- group_vars/all/splunk_packages | 15 ++++++ group_vars/all/splunk_repository | 6 +++ group_vars/splunk_indexers | 7 --- ...k_cluster_masternode => splunk_masternode} | 1 + group_vars/splunk_site0 | 6 +++ group_vars/splunk_site1 | 6 +++ group_vars/splunk_site2 | 6 +++ hosts | 16 ------- hosts_production.template | 48 +++++++++++++++++++ roles/common/tasks/add_authorized_key.yml | 2 +- splunk_download.yml | 28 +++++++---- splunk_repository_setup.yml | 10 ++-- 14 files changed, 121 insertions(+), 43 deletions(-) rename group_vars/{all => all/splunk_installation} (83%) create mode 100644 group_vars/all/splunk_packages create mode 100644 group_vars/all/splunk_repository rename group_vars/{splunk_cluster_masternode => splunk_masternode} (98%) create mode 100644 group_vars/splunk_site0 create mode 100644 group_vars/splunk_site1 create mode 100644 group_vars/splunk_site2 delete mode 100644 hosts create mode 100644 hosts_production.template diff --git a/README/server_conf.spec b/README/server_conf.spec index bd10c42..6714048 100644 --- a/README/server_conf.spec +++ b/README/server_conf.spec @@ -54,6 +54,10 @@ splunk_server_conf: * List of available sites * Defaults to an empty string. So if multisite is turned on this needs to be explicitly set + cluster_label: [dynamic|] + * Defaults to an empty string. + * Use dynamic to set automatically + replication_port: port: * Replication port diff --git a/group_vars/all b/group_vars/all/splunk_installation similarity index 83% rename from group_vars/all rename to group_vars/all/splunk_installation index 4801dc3..17d6e00 100644 --- a/group_vars/all +++ b/group_vars/all/splunk_installation @@ -1,18 +1,11 @@ --- -##################################################################################################################### -# Global Variables -##################################################################################################################### - -splunk_repository: - repository_root: /var/lib/splunk_repository - ##################################################################################################################### # Installation Variables ##################################################################################################################### splunk_installation: splunk_home_path: /opt/splunk version: 6.3.1 - ssh_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCnC6DzjkQjCXTMRqEWELAeehSldjqAemn3NflE6NKQ/wp7ekO6krRxALTBp3sD4wllCw7IRFkVPDpII29PszGxc/JL53yV2RgYRhzSxdDG5FuTKhS5FKRuQuoPPj3Y8qm1ZBxk+9W3Z/BWP593lkgLQ1v4ykO68p53+QCLy4Up1+Noyw3sRwpgx12OzDcIvjzZ2s8DjmApwXg23YB/TVS7OWG1A4AVVUa4cKq7CXnbY/uVluUnI7jUeOW1bsLnrgCuSbInxEyGmG/tcEm/2PAp22arTjpOEBvUNjdIwy6/Dhx4679pKh+KATjHpkM+iNWmy/zkl28Iv798pt8k+Zf" + ssh_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCnC6DzjkQjCXTMRqEWELAeehSldjqAemn3NflE6NKQ/wp7ekO6krRxALTBp3sD4wllCw7IRFkVPDpII29PszGxc/JL53yV2RgYRhzSxdDG5FuTKhS5FKRuQuoPPj3Y8qm1ZBxk+9W3Z/BWP593lkgLQ1v4ykO68p53+QCLy4Up1+Noyw3sRwpgx12OzDcIvjzZ2s8DjmApwXg23YB/TVS7OWG1A4AVVUa4cKq7CXnbY/uVluUnI7jUeOW1bsLnrgCuSbInxEyGmG/tcEm/2PAp22arTjpOEBvUNjdIwy6/Dhx4679pKh+KATjHpkM+iNWmy/zkl28Iv798pt8k+Zf7 root@linuxmint" package_format: rpm # package_format: [rpm|tgz] diff --git a/group_vars/all/splunk_packages b/group_vars/all/splunk_packages new file mode 100644 index 0000000..7547015 --- /dev/null +++ b/group_vars/all/splunk_packages @@ -0,0 +1,15 @@ +--- +##################################################################################################################### +# Splunk Package Variables +##################################################################################################################### + +splunk_packages: + linux_64_rpm: + package: + version: 6.3.1 + url: "http://download.splunk.com/products/splunk/releases/6.3.1/splunk/linux/splunk-6.3.1-f3e41e4b37b2-linux-2.6-x86_64.rpm" + + linux_64_tgz: + package: + version: "6.3.1" + url: "http://download.splunk.com/products/splunk/releases/6.3.1/splunk/linux/splunk-6.3.1-f3e41e4b37b2-Linux-x86_64.tgz" diff --git a/group_vars/all/splunk_repository b/group_vars/all/splunk_repository new file mode 100644 index 0000000..77ccea1 --- /dev/null +++ b/group_vars/all/splunk_repository @@ -0,0 +1,6 @@ +##################################################################################################################### +# Splunk Repository Variables +##################################################################################################################### + +splunk_repository: + repository_root: /var/lib/splunk_repository diff --git a/group_vars/splunk_indexers b/group_vars/splunk_indexers index 37e8774..14441cf 100644 --- a/group_vars/splunk_indexers +++ b/group_vars/splunk_indexers @@ -10,8 +10,6 @@ splunk_conf_path: /opt/splunk/etc/system/local ##################################################################################################################### splunk_inputs_conf: - splunktcp: - port: 9997 splunktcp_ssl: port: 9997 SSL: @@ -26,10 +24,7 @@ splunk_inputs_conf: splunk_web_conf: settings: enableSplunkWebSSL: true - httpport: 8000 startwebserver: 0 - privKeyPath: etc/auth/splunkweb/privkey.pem - caCertPath: etc/auth/splunkweb/cert.pem updateCheckerBaseURL: 0 ##################################################################################################################### @@ -48,8 +43,6 @@ splunk_server_conf: mode: slave master_uri: "https://clustermaster:8089" pass4SymmKey: SecretKey - replication_port: - port: 9888 replication_port_ssl: port: 9888 rootCA: $SPLUNK_HOME/etc/auth/cacert.pem diff --git a/group_vars/splunk_cluster_masternode b/group_vars/splunk_masternode similarity index 98% rename from group_vars/splunk_cluster_masternode rename to group_vars/splunk_masternode index 5851419..d6512b0 100644 --- a/group_vars/splunk_cluster_masternode +++ b/group_vars/splunk_masternode @@ -49,3 +49,4 @@ splunk_server_conf: site_replication_factor: "origin:2,total:3" search_factor: 2 available_sites: "site1,site2" + cluster_label: dynamic diff --git a/group_vars/splunk_site0 b/group_vars/splunk_site0 new file mode 100644 index 0000000..e869de8 --- /dev/null +++ b/group_vars/splunk_site0 @@ -0,0 +1,6 @@ +--- +##################################################################################################################### +# General Variables for site0 +##################################################################################################################### + +splunk_site = site0 diff --git a/group_vars/splunk_site1 b/group_vars/splunk_site1 new file mode 100644 index 0000000..de29606 --- /dev/null +++ b/group_vars/splunk_site1 @@ -0,0 +1,6 @@ +--- +##################################################################################################################### +# General Variables for site1 +##################################################################################################################### + +splunk_site = site1 diff --git a/group_vars/splunk_site2 b/group_vars/splunk_site2 new file mode 100644 index 0000000..2d65289 --- /dev/null +++ b/group_vars/splunk_site2 @@ -0,0 +1,6 @@ +--- +##################################################################################################################### +# General Variables for site2 +##################################################################################################################### + +splunk_site = site2 diff --git a/hosts b/hosts deleted file mode 100644 index 67791c2..0000000 --- a/hosts +++ /dev/null @@ -1,16 +0,0 @@ -[splunk_repository] -localhost ansible_connection=local - -[splunk_searchheads] -searchhead.production cluster=production shcluster=production site=site0 -searchhead.staging cluster=staging shcluster=staging site=site1 - -[splunk_indexers] -indexer.production cluster_label=production site=site1 -indexer.staging cluster_label=staging site=site0 - -[splunk_licensemaster] -searchhead - -[splunk_cluster_masternode] -clustermasternode diff --git a/hosts_production.template b/hosts_production.template new file mode 100644 index 0000000..4899750 --- /dev/null +++ b/hosts_production.template @@ -0,0 +1,48 @@ +[splunk_repository] +localhost ansible_connection=local + +[splunk_searchheads] +searchhead1.private.domain +searchhead2.private.domain +searchhead3.private.domain + +[splunk_indexers] +indexer1.private.domain +indexer2.private.domain + +[splunk_licensemaster] +searchhead.private.domain + +[splunk_deployer] +deployer.private.domain + +[splunk_masternode] +masternode.private.domain + +[splunk_deploymentserver] +deploymentserver.private.domain + +[splunk_dmc] +dmc.private.domain + +[splunk_site0] +dmc.private.domain + +[splunk_site1] +searchhead1.private.domain +searchhead2.private.domain +indexer1.private.domain + +[splunk_site2] +indexer2.private.domain + +[splunk_sh_cluter_production] +deployer.private.domain +searchhead1.private.domain +searchhead2.private.domain +searchhead3.private.domain + +[splunk_cluster_production] +masternode.private.domain +indexer1.private.domain +indexer2.private.domain diff --git a/roles/common/tasks/add_authorized_key.yml b/roles/common/tasks/add_authorized_key.yml index 3ea8153..14a6465 100644 --- a/roles/common/tasks/add_authorized_key.yml +++ b/roles/common/tasks/add_authorized_key.yml @@ -1,6 +1,6 @@ --- -- name: Add private key to user splunk +- name: Add authorized key to user splunk authorized_key: user=splunk key="{{ splunk_installation.ssh_public_key }}" when: splunk_installation.ssh_public_key is defined diff --git a/splunk_download.yml b/splunk_download.yml index 52022dc..00b1d06 100644 --- a/splunk_download.yml +++ b/splunk_download.yml @@ -1,9 +1,21 @@ --- -- hosts: splunk_repository - tasks: - - name: Download Splunk package - get_url: url={{ splunk_installation.package_url }} - dest={{ splunk_repository.repository_root }}/packages - owner={{ splunk_repository.repository_owner }} - group={{ splunk_repository.repository_group }} - mode=644 +- hosts: splunk_repository + tasks: + - name: Download Splunk rpm packages + get_url: url="{{ item.value.url }}" + dest={{ splunk_repository.repository_root }}/packages + owner={{ splunk_repository.repository_owner }} + group={{ splunk_repository.repository_group }} + mode=644 + with_dict: "{{ splunk_packages.linux_64_rpm }}" + when: splunk_installation.package_format == "rpm" + + - name: Download Splunk tgz packages + get_url: url="{{ item.value.url }}" + dest={{ splunk_repository.repository_root }}/packages + owner={{ splunk_repository.repository_owner }} + group={{ splunk_repository.repository_group }} + mode=644 + with_dict: "{{ splunk_packages.linux_64_tgz }}" + when: splunk_installation.package_format == "tgz" + diff --git a/splunk_repository_setup.yml b/splunk_repository_setup.yml index 536b689..aeadccc 100644 --- a/splunk_repository_setup.yml +++ b/splunk_repository_setup.yml @@ -15,8 +15,12 @@ state=directory - name: Set repository owner/group - file: path={{ splunk_repository.repository_root }} recurse=yes owner={{ splunk_repository.repository_owner }} group={{ splunk_repository.repository_group }} + file: path={{ splunk_repository.repository_root }} + recurse=yes + owner={{ splunk_repository.repository_owner }} + group={{ splunk_repository.repository_group }} - - name: Set repository owner/group - file: path={{ splunk_repository.repository_root }} mode=750 + - name: Set repository directory mode + file: path={{ splunk_repository.repository_root }} + mode=750