From ba987198cd381a10b5075eac599fee9d2f6219d9 Mon Sep 17 00:00:00 2001 From: Kamil Wiatrowski Date: Wed, 3 Oct 2018 14:59:28 +0200 Subject: Add role to auto install docker on hosts - missing patch Small updates to ansible roles. Several minor updates in documentation. Change-Id: Id031cebc23301b6218f8ced0d261f844f270e37f Signed-off-by: Kamil Wiatrowski --- docker/ansible/roles/config_files/tasks/mcelog.yml | 2 + docker/ansible/roles/config_files/vars/main.yml | 5 +- docker/ansible/roles/run_grafana/vars/main.yml | 4 +- docs/release/userguide/docker.userguide.rst | 53 +++++++++++++++++----- 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/docker/ansible/roles/config_files/tasks/mcelog.yml b/docker/ansible/roles/config_files/tasks/mcelog.yml index bab4b142..794db98c 100644 --- a/docker/ansible/roles/config_files/tasks/mcelog.yml +++ b/docker/ansible/roles/config_files/tasks/mcelog.yml @@ -17,6 +17,7 @@ package: name: mcelog state: present + ignore_errors: "true" when: install_mcelog|default(false)|bool tags: - mcelogs @@ -26,6 +27,7 @@ name: mcelog state: started enabled: true + ignore_errors: "true" when: install_mcelog|default(false)|bool tags: - mcelogs diff --git a/docker/ansible/roles/config_files/vars/main.yml b/docker/ansible/roles/config_files/vars/main.yml index bfa0fd68..ab4a7867 100644 --- a/docker/ansible/roles/config_files/vars/main.yml +++ b/docker/ansible/roles/config_files/vars/main.yml @@ -23,7 +23,10 @@ interval_value: 10 #network plugin vars network_port: 25826 -network_ip_addr: "{{ (groups['influxdb_hosts']|default({}))[0] | default('localhost') }}" +#get influxdb name as defined in inventory +influxdb_hostname: "{{ (groups['influxdb_hosts']|default({}))[0] | default('localhost') }}" +#get hostname as used by ansible +network_ip_addr: "{{ hostvars[influxdb_hostname].ansible_hostname }}" #ovs event and stats plugin vars ovs_event_interval: 1 diff --git a/docker/ansible/roles/run_grafana/vars/main.yml b/docker/ansible/roles/run_grafana/vars/main.yml index 5caf45da..0975b598 100644 --- a/docker/ansible/roles/run_grafana/vars/main.yml +++ b/docker/ansible/roles/run_grafana/vars/main.yml @@ -13,5 +13,5 @@ # limitations under the License. --- -influxdb_hostname: influxdb_host -influxdb_host_ip: "{{ (groups['influxdb_hosts']|default({}))[0] | default('localhost') }}" +influxdb_hostname: localhost +influxdb_host_ip: 127.0.0.1 diff --git a/docs/release/userguide/docker.userguide.rst b/docs/release/userguide/docker.userguide.rst index 258d122d..b212190b 100644 --- a/docs/release/userguide/docker.userguide.rst +++ b/docs/release/userguide/docker.userguide.rst @@ -94,8 +94,8 @@ Kafka recieves and stores metrics recieved from Collectd. VES application pulls which it normalizes into VES format for sending to a VES collector. Please see details in :ref:`VES Application User Guide ` -Download and Run Docker Images with Ansible-Playbook ----------------------------------------------------- +One Click Install with Ansible +------------------------------ Install Ansible ^^^^^^^^^^^^^^^ @@ -103,6 +103,7 @@ Install Ansible * sudo permissions or root access are required to install ansible. * ansible version needs to be 2.4+, because usage of import/include statements +The following steps have been verified with Ansible 2.6.3 on Ubuntu 16.04 and 18.04. To install Ansible 2.6.3 on Ubuntu: .. code:: bash @@ -111,6 +112,7 @@ To install Ansible 2.6.3 on Ubuntu: $ sudo apt-get install python-pip $ sudo pip install 'ansible==2.6.3' +The following steps have been verified with Ansible 2.6.3 on Centos 7.5. To install Ansible 2.6.3 on Centos: .. code:: bash @@ -130,7 +132,7 @@ Clone barometer repo Edit inventory file ^^^^^^^^^^^^^^^^^^^ -Edit inventory file and add hosts: ~/default.inv +Edit inventory file and add hosts: $barometer_dir/docker/ansible/default.inv .. code:: bash @@ -174,6 +176,12 @@ and insert_ipmi_modules, both variables are independent: install_mcelog=false insert_ipmi_modules=false +.. note:: + On Ubuntu 18.04 to use mcelog plugin the user has to install mcelog daemon + manually ahead of installing from ansible scripts as the deb package is not + available in official Ubuntu 18.04 repo. It means that setting install_mcelog + to true is ignored. + Configure ssh keys ^^^^^^^^^^^^^^^^^^ @@ -183,18 +191,34 @@ Generate ssh keys if not present, otherwise move onto next step. $ sudo ssh-keygen -Coppy ssh key to all target hosts. It requires to provide root password. The example is for localhost. +Copy ssh key to all target hosts. It requires to provide root password. +The example is for localhost. .. code:: bash $ sudo ssh-copy-id root@localhost -Download collectd+influxdb+grafana containers -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Verify that key is added and password is not required to connect. + +.. code:: bash + + $ sudo ssh root@localhost + +.. note:: + Keys should be added to every target host and [localhost] is only used as an + example. For multinode installation keys need to be copied for each node: + [collectd_hostname], [influxdb_hostname] etc. + +Download and run Collectd+Influxdb+Grafana containers +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The One Click installation features easy and scalable deployment of Collectd, +Influxdb and Grafana containers using Ansible playbook. The following steps goes +through more details. .. code:: bash - $ sudo ansible-playbook -i ~/default.inv collectd_service.yml + $ sudo ansible-playbook -i default.inv collectd_service.yml Check the three containers are running, the output of docker ps should be similar to: @@ -212,7 +236,9 @@ To make some changes when a container is running run: $ sudo docker exec -ti /bin/bash -Connect to :3000 with a browser and log into grafana: admin/admin +Connect to :3000 with a browser and log into Grafana: admin/admin. +For short introduction please see the: +`Grafana guide `_. The collectd configuration files can be accessed directly on target system in '/opt/collectd/etc/collectd.conf.d'. It can be used for manual changes or enable/disable plugins. If configuration has been modified it is required to @@ -230,7 +256,7 @@ The 'zookeeper_hostname' and 'broker_id' can be set in ./roles/run_kafka/vars/ma .. code:: bash - $ sudo ansible-playbook -i ~/default.inv collectd_ves.yml + $ sudo ansible-playbook -i default.inv collectd_ves.yml Check the three containers are running, the output of docker ps should be similar to: @@ -270,13 +296,13 @@ To run a specific parts only: .. code:: bash - $ sudo ansible-playbook -i ~/default.inv collectd_service.yml --tags "syslog,cpu,uuid" + $ sudo ansible-playbook -i default.inv collectd_service.yml --tags "syslog,cpu,uuid" To disable some parts or plugins: .. code:: bash - $ sudo ansible-playbook -i ~/default.inv collectd_service.yml --skip-tags "en_default_all,syslog,cpu,uuid" + $ sudo ansible-playbook -i default.inv collectd_service.yml --skip-tags "en_default_all,syslog,cpu,uuid" List of available tags: @@ -308,6 +334,11 @@ Installing Docker .. Describe the specific capabilities and usage for feature. .. Provide enough information that a user will be able to operate the feature on a deployed scenario. +.. note:: + The below sections provide steps for manual installation and configuration + of docker images. They are not neccessary if docker images were installed with + use of Ansible-Playbook. + On Ubuntu ^^^^^^^^^^ .. note:: -- cgit 1.2.3-korg