diff options
Diffstat (limited to 'ansible/roles/watcher')
| -rw-r--r-- | ansible/roles/watcher/defaults/main.yml | 38 | ||||
| -rw-r--r-- | ansible/roles/watcher/meta/main.yml | 3 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/bootstrap.yml | 41 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/bootstrap_service.yml | 20 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/config.yml | 52 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/deploy.yml | 16 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/main.yml | 2 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/precheck.yml | 1 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/pull.yml | 21 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/reconfigure.yml | 71 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/register.yml | 40 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/start.yml | 36 | ||||
| -rw-r--r-- | ansible/roles/watcher/tasks/upgrade.yml | 6 | ||||
| -rw-r--r-- | ansible/roles/watcher/templates/watcher-api.json.j2 | 18 | ||||
| -rw-r--r-- | ansible/roles/watcher/templates/watcher-applier.json.j2 | 18 | ||||
| -rw-r--r-- | ansible/roles/watcher/templates/watcher-engine.json.j2 | 18 | ||||
| -rw-r--r-- | ansible/roles/watcher/templates/watcher.conf.j2 | 43 |
17 files changed, 0 insertions, 444 deletions
diff --git a/ansible/roles/watcher/defaults/main.yml b/ansible/roles/watcher/defaults/main.yml deleted file mode 100644 index 28f300bcb..000000000 --- a/ansible/roles/watcher/defaults/main.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -project_name: "watcher" - -#################### -# Database -#################### -watcher_database_name: "watcher" -watcher_database_user: "watcher" -watcher_database_address: "{{ kolla_internal_fqdn }}:{{ database_port }}" - - -#################### -# Docker -#################### -watcher_engine_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-watcher-engine" -watcher_engine_tag: "{{ openstack_release }}" -watcher_engine_image_full: "{{ watcher_engine_image }}:{{ watcher_engine_tag }}" - -watcher_api_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-watcher-api" -watcher_api_tag: "{{ openstack_release }}" -watcher_api_image_full: "{{ watcher_api_image }}:{{ watcher_api_tag }}" - -watcher_applier_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-watcher-applier" -watcher_applier_tag: "{{ openstack_release }}" -watcher_applier_image_full: "{{ watcher_applier_image }}:{{ watcher_applier_tag }}" - -#################### -# OpenStack -#################### -watcher_admin_endpoint: "{{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ watcher_api_port }}" -watcher_internal_endpoint: "{{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ watcher_api_port }}" -watcher_public_endpoint: "{{ public_protocol }}://{{ kolla_external_fqdn }}:{{ watcher_api_port }}" - -watcher_logging_debug: "{{ openstack_logging_debug }}" - -watcher_keystone_user: "watcher" - -openstack_watcher_auth: "{'auth_url':'{{ openstack_auth.auth_url }}','username':'{{ openstack_auth.username }}','password':'{{ openstack_auth.password }}','project_name':'{{ openstack_auth.project_name }}'}" diff --git a/ansible/roles/watcher/meta/main.yml b/ansible/roles/watcher/meta/main.yml deleted file mode 100644 index 6b4fff8fe..000000000 --- a/ansible/roles/watcher/meta/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: - - { role: common } diff --git a/ansible/roles/watcher/tasks/bootstrap.yml b/ansible/roles/watcher/tasks/bootstrap.yml deleted file mode 100644 index fa63250e3..000000000 --- a/ansible/roles/watcher/tasks/bootstrap.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- name: Creating Watcher database - command: docker exec -t kolla_toolbox /usr/bin/ansible localhost - -m mysql_db - -a "login_host='{{ database_address }}' - login_port='{{ database_port }}' - login_user='{{ database_user }}' - login_password='{{ database_password }}' - name='{{ watcher_database_name }}'" - register: database - changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and - (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - failed_when: database.stdout.split()[2] != 'SUCCESS' - run_once: True - delegate_to: "{{ groups['watcher-api'][0] }}" - -- name: Reading json from variable - set_fact: - database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - -- name: Creating Watcher database user and setting permissions - command: docker exec -t kolla_toolbox /usr/bin/ansible localhost - -m mysql_user - -a "login_host='{{ database_address }}' - login_port='{{ database_port }}' - login_user='{{ database_user }}' - login_password='{{ database_password }}' - name='{{ watcher_database_name }}' - password='{{ watcher_database_password }}' - host='%' - priv='{{ watcher_database_name }}.*:ALL' - append_privs='yes'" - register: database_user_create - changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and - (database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - failed_when: database_user_create.stdout.split()[2] != 'SUCCESS' - run_once: True - delegate_to: "{{ groups['watcher-api'][0] }}" - -- include: bootstrap_service.yml - when: database_created diff --git a/ansible/roles/watcher/tasks/bootstrap_service.yml b/ansible/roles/watcher/tasks/bootstrap_service.yml deleted file mode 100644 index 802737bd2..000000000 --- a/ansible/roles/watcher/tasks/bootstrap_service.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Running Watcher bootstrap container - kolla_docker: - action: "start_container" - common_options: "{{ docker_common_options }}" - detach: False - environment: - KOLLA_BOOTSTRAP: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - image: "{{ watcher_api_image_full }}" - labels: - BOOTSTRAP: - name: "bootstrap_watcher" - restart_policy: "never" - volumes: - - "{{ node_config_directory }}/watcher-api/:{{ container_config_directory }}/:ro" - - "/etc/localtime:/etc/localtime:ro" - - "kolla_logs:/var/log/kolla/" - run_once: True - delegate_to: "{{ groups['watcher-api'][0] }}" diff --git a/ansible/roles/watcher/tasks/config.yml b/ansible/roles/watcher/tasks/config.yml deleted file mode 100644 index 9f32f9398..000000000 --- a/ansible/roles/watcher/tasks/config.yml +++ /dev/null @@ -1,52 +0,0 @@ ---- -- name: Ensuring config directories exist - file: - path: "{{ node_config_directory }}/{{ item }}" - state: "directory" - recurse: yes - with_items: - - "watcher-api" - - "watcher-engine" - - "watcher-applier" - -- name: Copying over config.json files for services - template: - src: "{{ item }}.json.j2" - dest: "{{ node_config_directory }}/{{ item }}/config.json" - with_items: - - "watcher-api" - - "watcher-engine" - - "watcher-applier" - -- name: Copying over watcher.conf - merge_configs: - vars: - service_name: "{{ item }}" - sources: - - "{{ role_path }}/templates/watcher.conf.j2" - - "{{ node_config_directory }}/config/global.conf" - - "{{ node_config_directory }}/config/database.conf" - - "{{ node_config_directory }}/config/messaging.conf" - - "{{ node_config_directory }}/config/watcher.conf" - - "{{ node_config_directory }}/config/watcher/{{ item }}.conf" - - "{{ node_config_directory }}/config/watcher/{{ inventory_hostname }}/watcher.conf" - dest: "{{ node_config_directory }}/{{ item }}/watcher.conf" - with_items: - - "watcher-api" - - "watcher-engine" - - "watcher-applier" - -- name: Check if policies shall be overwritten - local_action: stat path="{{ node_custom_config }}/watcher/policy.json" - register: watcher_policy - -- name: Copying over existing policy.json - template: - src: "{{ node_custom_config }}/watcher/policy.json" - dest: "{{ node_config_directory }}/{{ item }}/policy.json" - with_items: - - "watcher-api" - - "watcher-engine" - - "watcher-applier" - when: - watcher_policy.stat.exists diff --git a/ansible/roles/watcher/tasks/deploy.yml b/ansible/roles/watcher/tasks/deploy.yml deleted file mode 100644 index d589a67b1..000000000 --- a/ansible/roles/watcher/tasks/deploy.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- include: register.yml - when: inventory_hostname in groups['watcher-api'] - -- include: config.yml - when: inventory_hostname in groups['watcher-api'] or - inventory_hostname in groups['watcher-engine'] or - inventory_hostname in groups['watcher-applier'] - -- include: bootstrap.yml - when: inventory_hostname in groups['watcher-api'] - -- include: start.yml - when: inventory_hostname in groups['watcher-api'] or - inventory_hostname in groups['watcher-engine'] or - inventory_hostname in groups['watcher-applier'] diff --git a/ansible/roles/watcher/tasks/main.yml b/ansible/roles/watcher/tasks/main.yml deleted file mode 100644 index b017e8b4a..000000000 --- a/ansible/roles/watcher/tasks/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- include: "{{ action }}.yml" diff --git a/ansible/roles/watcher/tasks/precheck.yml b/ansible/roles/watcher/tasks/precheck.yml deleted file mode 100644 index ed97d539c..000000000 --- a/ansible/roles/watcher/tasks/precheck.yml +++ /dev/null @@ -1 +0,0 @@ ---- diff --git a/ansible/roles/watcher/tasks/pull.yml b/ansible/roles/watcher/tasks/pull.yml deleted file mode 100644 index a4e20fb64..000000000 --- a/ansible/roles/watcher/tasks/pull.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Pulling watcher-api image - kolla_docker: - action: "pull_image" - common_options: "{{ docker_common_options }}" - image: "{{ watcher_api_image_full }}" - when: inventory_hostname in groups['watcher-api'] - -- name: Pulling watcher-engine image - kolla_docker: - action: "pull_image" - common_options: "{{ docker_common_options }}" - image: "{{ watcher_engine_image_full }}" - when: inventory_hostname in groups['watcher-engine'] - -- name: Pulling watcher-applier image - kolla_docker: - action: "pull_image" - common_options: "{{ docker_common_options }}" - image: "{{ watcher_applier_image_full }}" - when: inventory_hostname in groups['watcher-applier'] diff --git a/ansible/roles/watcher/tasks/reconfigure.yml b/ansible/roles/watcher/tasks/reconfigure.yml deleted file mode 100644 index e28ec6ab6..000000000 --- a/ansible/roles/watcher/tasks/reconfigure.yml +++ /dev/null @@ -1,71 +0,0 @@ ---- -- name: Ensuring the containers up - kolla_docker: - name: "{{ item.name }}" - action: "get_container_state" - register: container_state - failed_when: container_state.Running == false - when: inventory_hostname in groups[item.group] - with_items: - - { name: watcher_api, group: watcher-api } - - { name: watcher_engine, group: watcher-engine } - - { name: watcher_applier, group: watcher-applier } - -- include: config.yml - -- name: Check the configs - command: docker exec {{ item.name }} /usr/local/bin/kolla_set_configs --check - changed_when: false - failed_when: false - register: check_results - when: inventory_hostname in groups[item.group] - with_items: - - { name: watcher_api, group: watcher-api } - - { name: watcher_engine, group: watcher-engine } - - { name: watcher_applier, group: watcher-applier } - -- name: Containers config strategy - kolla_docker: - name: "{{ item.name }}" - action: "get_container_env" - register: container_envs - when: inventory_hostname in groups[item.group] - with_items: - - { name: watcher_api, group: watcher-api } - - { name: watcher_engine, group: watcher-engine } - - { name: watcher_applier, group: watcher-applier } - -- name: Remove the containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "remove_container" - register: remove_containers - when: - - inventory_hostname in groups[item[0]['group']] - - config_strategy == "COPY_ONCE" or item[1]['KOLLA_CONFIG_STRATEGY'] == 'COPY_ONCE' - - item[2]['rc'] == 1 - with_together: - - [{ name: watcher_api, group: watcher-api }, - { name: watcher_engine, group: watcher-engine }, - { name: watcher_applier, group: watcher-applier }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" - -- include: start.yml - when: remove_containers.changed - -- name: Restart containers - kolla_docker: - name: "{{ item[0]['name'] }}" - action: "restart_container" - when: - - config_strategy == 'COPY_ALWAYS' - - item[1]['KOLLA_CONFIG_STRATEGY'] != 'COPY_ONCE' - - item[2]['rc'] == 1 - - inventory_hostname in groups[item[0]['group']] - with_together: - - [{ name: watcher_api, group: watcher-api }, - { name: watcher_engine, group: watcher-engine }, - { name: watcher_applier, group: watcher-applier }] - - "{{ container_envs.results }}" - - "{{ check_results.results }}" diff --git a/ansible/roles/watcher/tasks/register.yml b/ansible/roles/watcher/tasks/register.yml deleted file mode 100644 index 59a2e2182..000000000 --- a/ansible/roles/watcher/tasks/register.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- name: Creating the Watcher service and endpoint - command: docker exec -t kolla_toolbox /usr/bin/ansible localhost - -m kolla_keystone_service - -a "service_name=watcher - service_type=infra-optim - description='Infrastructure Optimization service' - endpoint_region={{ openstack_region_name }} - url='{{ item.url }}' - interface='{{ item.interface }}' - region_name={{ openstack_region_name }} - auth={{ '{{ openstack_watcher_auth }}' }}" - -e "{'openstack_watcher_auth':{{ openstack_watcher_auth }}}" - register: watcher_endpoint - changed_when: "{{ watcher_endpoint.stdout.find('localhost | SUCCESS => ') != -1 and (watcher_endpoint.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - until: watcher_endpoint.stdout.split()[2] == 'SUCCESS' - retries: 10 - delay: 5 - run_once: True - with_items: - - {'interface': 'admin', 'url': '{{ watcher_admin_endpoint }}'} - - {'interface': 'internal', 'url': '{{ watcher_internal_endpoint }}'} - - {'interface': 'public', 'url': '{{ watcher_public_endpoint }}'} - -- name: Creating the Watcher project, user, and role - command: docker exec -t kolla_toolbox /usr/bin/ansible localhost - -m kolla_keystone_user - -a "project=service - user=watcher - password={{ watcher_keystone_password }} - role=admin - region_name={{ openstack_region_name }} - auth={{ '{{ openstack_watcher_auth }}' }}" - -e "{'openstack_watcher_auth':{{ openstack_watcher_auth }}}" - register: watcher_user - changed_when: "{{ watcher_user.stdout.find('localhost | SUCCESS => ') != -1 and (watcher_user.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}" - until: watcher_user.stdout.split()[2] == 'SUCCESS' - retries: 10 - delay: 5 - run_once: True diff --git a/ansible/roles/watcher/tasks/start.yml b/ansible/roles/watcher/tasks/start.yml deleted file mode 100644 index e88e3f853..000000000 --- a/ansible/roles/watcher/tasks/start.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- name: Starting watcher-applier container - kolla_docker: - action: "start_container" - common_options: "{{ docker_common_options }}" - image: "{{ watcher_applier_image_full }}" - name: "watcher_applier" - volumes: - - "{{ node_config_directory }}/watcher-applier/:{{ container_config_directory }}/:ro" - - "/etc/localtime:/etc/localtime:ro" - - "kolla_logs:/var/log/kolla/" - when: inventory_hostname in groups['watcher-applier'] - -- name: Starting watcher-engine container - kolla_docker: - action: "start_container" - common_options: "{{ docker_common_options }}" - image: "{{ watcher_engine_image_full }}" - name: "watcher_engine" - volumes: - - "{{ node_config_directory }}/watcher-engine/:{{ container_config_directory }}/:ro" - - "/etc/localtime:/etc/localtime:ro" - - "kolla_logs:/var/log/kolla/" - when: inventory_hostname in groups['watcher-engine'] - -- name: Starting watcher-api container - kolla_docker: - action: "start_container" - common_options: "{{ docker_common_options }}" - image: "{{ watcher_api_image_full }}" - name: "watcher_api" - volumes: - - "{{ node_config_directory }}/watcher-api/:{{ container_config_directory }}/:ro" - - "/etc/localtime:/etc/localtime:ro" - - "kolla_logs:/var/log/kolla/" - when: inventory_hostname in groups['watcher-api'] diff --git a/ansible/roles/watcher/tasks/upgrade.yml b/ansible/roles/watcher/tasks/upgrade.yml deleted file mode 100644 index 308053080..000000000 --- a/ansible/roles/watcher/tasks/upgrade.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- include: config.yml - -- include: bootstrap_service.yml - -- include: start.yml diff --git a/ansible/roles/watcher/templates/watcher-api.json.j2 b/ansible/roles/watcher/templates/watcher-api.json.j2 deleted file mode 100644 index 422313e77..000000000 --- a/ansible/roles/watcher/templates/watcher-api.json.j2 +++ /dev/null @@ -1,18 +0,0 @@ -{ - "command": "watcher-api --config-file /etc/watcher/watcher.conf", - "config_files": [ - { - "source": "{{ container_config_directory }}/watcher.conf", - "dest": "/etc/watcher/watcher.conf", - "owner": "watcher", - "perm": "0644" - } - ], - "permissions": [ - { - "path": "/var/log/kolla/watcher", - "owner": "watcher:watcher", - "recurse": true - } - ] -} diff --git a/ansible/roles/watcher/templates/watcher-applier.json.j2 b/ansible/roles/watcher/templates/watcher-applier.json.j2 deleted file mode 100644 index 2fae81a0e..000000000 --- a/ansible/roles/watcher/templates/watcher-applier.json.j2 +++ /dev/null @@ -1,18 +0,0 @@ -{ - "command": "watcher-applier --config-file /etc/watcher/watcher.conf", - "config_files": [ - { - "source": "{{ container_config_directory }}/watcher.conf", - "dest": "/etc/watcher/watcher.conf", - "owner": "watcher", - "perm": "0644" - } - ], - "permissions": [ - { - "path": "/var/log/kolla/watcher", - "owner": "watcher:watcher", - "recurse": true - } - ] -} diff --git a/ansible/roles/watcher/templates/watcher-engine.json.j2 b/ansible/roles/watcher/templates/watcher-engine.json.j2 deleted file mode 100644 index acf60e930..000000000 --- a/ansible/roles/watcher/templates/watcher-engine.json.j2 +++ /dev/null @@ -1,18 +0,0 @@ -{ - "command": "watcher-decision-engine --config-file /etc/watcher/watcher.conf", - "config_files": [ - { - "source": "{{ container_config_directory }}/watcher.conf", - "dest": "/etc/watcher/watcher.conf", - "owner": "watcher", - "perm": "0644" - } - ], - "permissions": [ - { - "path": "/var/log/kolla/watcher", - "owner": "watcher:watcher", - "recurse": true - } - ] -} diff --git a/ansible/roles/watcher/templates/watcher.conf.j2 b/ansible/roles/watcher/templates/watcher.conf.j2 deleted file mode 100644 index 5a2a3afda..000000000 --- a/ansible/roles/watcher/templates/watcher.conf.j2 +++ /dev/null @@ -1,43 +0,0 @@ -[DEFAULT] -debug = {{ watcher_logging_debug }} - -log_dir = /var/log/kolla/watcher - -transport_url = rabbit://{% for host in groups['rabbitmq'] %}{{ rabbitmq_user }}:{{ rabbitmq_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ rabbitmq_port }}{% if not loop.last %},{% endif %}{% endfor %} - -{% if service_name == 'watcher-api' %} -[api] -host = {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} -port = {{ watcher_api_port }} -{% endif %} - -[database] -connection = mysql+pymysql://{{ watcher_database_user }}:{{ watcher_database_password }}@{{ watcher_database_address}}/{{ watcher_database_name }} -max_retries = -1 - -[keystone_authtoken] -auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }} -auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }} -auth_type = password -project_domain_id = default -user_domain_id = default -project_name = service -username = {{ watcher_keystone_user }} -password = {{ watcher_keystone_password }} - -memcache_security_strategy = ENCRYPT -memcache_secret_key = {{ memcache_secret_key }} -memcached_servers = {% for host in groups['memcached'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %} - -[watcher_clients_auth] -auth_uri = {{ internal_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_public_port }} -auth_url = {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }} -auth_type = password -project_domain_id = default -user_domain_id = default -project_name = service -username = {{ watcher_keystone_user }} -password = {{ watcher_keystone_password }} - -[oslo_concurrency] -lock_path = /var/lib/watcher/tmp |
