diff --git a/defaults/main.yml b/defaults/main.yml index 7506129..3bba31d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,14 +17,18 @@ # (c) 2016 Donovan Francesco # (c) 2016 Paul Stevens -#python venv executable +# python venv executable trove_venv_python_executable: "{{ openstack_venv_python_executable | default('python3') }}" # Set the host which will execute the shade modules # for the service setup. The host must already have # clouds.yaml properly configured. trove_service_setup_host: "{{ openstack_service_setup_host | default('localhost') }}" -trove_service_setup_host_python_interpreter: "{{ openstack_service_setup_host_python_interpreter | default((trove_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +trove_service_setup_host_python_interpreter: >- + {{ + openstack_service_setup_host_python_interpreter | default( + (trove_service_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) + }} trove_package_state: "{{ package_state | default('latest') }}" @@ -67,7 +71,8 @@ trove_profiler_enabled: false ## Cap the maximum number of threads / workers when a user value is unspecified. trove_api_workers_max: 16 -trove_api_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, trove_api_workers_max] | min }}" +trove_api_workers: >- + {{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, trove_api_workers_max] | min }} # uWSGI settings trove_wsgi_threads: 1 @@ -78,7 +83,8 @@ trove_uwsgi_tls: ## Cap the maximum number of threads / workers when a user value is unspecified. trove_conductor_workers_max: 16 -trove_conductor_workers: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, trove_conductor_workers_max] | min }}" +trove_conductor_workers: >- + {{ [[(ansible_facts['processor_vcpus'] // ansible_facts['processor_threads_per_core']) | default(1), 1] | max * 2, trove_conductor_workers_max] | min }} # Enable/Disable Ceilometer trove_ceilometer_enabled: "{{ (groups['ceilometer_all'] is defined) and (groups['ceilometer_all'] | length > 0) }}" @@ -91,20 +97,28 @@ trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin" trove_git_repo: "https://opendev.org/openstack/trove" trove_git_install_branch: master -trove_upper_constraints_url: "{{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }}" +trove_upper_constraints_url: >- + {{ requirements_git_url | default('https://releases.openstack.org/constraints/upper/' ~ requirements_git_install_branch | default('master')) }} trove_git_constraints: - "--constraint {{ trove_upper_constraints_url }}" # Database vars trove_db_setup_host: "{{ openstack_db_setup_host | default('localhost') }}" -trove_db_setup_python_interpreter: "{{ openstack_db_setup_python_interpreter | default((trove_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) }}" +trove_db_setup_python_interpreter: >- + {{ + openstack_db_setup_python_interpreter | default( + (trove_db_setup_host == 'localhost') | ternary(ansible_playbook_python, ansible_facts['python']['executable'])) + }} trove_galera_address: "{{ galera_address | default('127.0.0.1') }}" trove_galera_database_name: trove trove_galera_user: trove trove_galera_use_ssl: "{{ galera_use_ssl | default(False) }}" trove_galera_ssl_ca_cert: "{{ galera_ssl_ca_cert | default('') }}" trove_galera_port: "{{ galera_port | default('3306') }}" -trove_galera_connection_string: "mysql+pymysql://{{ trove_galera_user}}:{{ trove_galera_password }}@{{ trove_galera_address }}:{{ trove_galera_port }}/{{ trove_galera_database_name }}?charset=utf8{% if trove_galera_use_ssl | bool %}&ssl_verify_cert=true{% if trove_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ trove_galera_ssl_ca_cert }}{% endif %}{% endif %}" +trove_galera_connection_string: >- + mysql+pymysql://{{ trove_galera_user}}:{{ trove_galera_password }}@{{ trove_galera_address }}:{{ trove_galera_port }}/{{ trove_galera_database_name + }}?charset=utf8{% if trove_galera_use_ssl | bool %}&ssl_verify_cert=true{% + if trove_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ trove_galera_ssl_ca_cert }}{% endif %}{% endif %} trove_db_max_overflow: "{{ openstack_db_max_overflow | default('50') }}" trove_db_max_pool_size: "{{ openstack_db_max_pool_size | default('5') }}" trove_db_pool_timeout: "{{ openstack_db_pool_timeout | default('30') }}" @@ -155,15 +169,28 @@ trove_rabbit_notification_topic: notification # # The value of 'net_name' field of the provider network network to use for infrastructure services trove_provider_net_name: dbaas-mgmt -trove_provider_network: "{{ provider_networks|map(attribute='network')|selectattr('net_name','defined')|selectattr('net_name', 'equalto', trove_provider_net_name)|list|first }}" +trove_provider_network: >- + {{ + provider_networks | map(attribute='network') | selectattr('net_name','defined') | selectattr( + 'net_name', 'equalto', trove_provider_net_name + ) | list | first + }} # The name of the network interface trove_provider_net_iface: "{{ (is_metal | bool) | ternary(trove_provider_network['container_bridge'], trove_provider_network['container_interface']) }}" trove_guest_endpoint_type: public trove_guest_rpc_host_group: "{{ oslomsg_rpc_host_group | default('rabbitmq_all') }}" -trove_guest_oslomsg_rpc_servers: "{{ groups[trove_guest_rpc_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_')) | map(attribute='ipv4.address') | join(',') }}" +trove_guest_oslomsg_rpc_servers: >- + {{ + groups[trove_guest_rpc_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_') + ) | map(attribute='ipv4.address') | join(',') + }} trove_guest_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}" trove_guest_notify_host_group: "{{ oslomsg_notify_host_group | default('rabbitmq_all') }}" -trove_guest_oslomsg_notify_servers: "{{ groups[trove_guest_notify_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_')) | map(attribute='ipv4.address') | join(',') }}" +trove_guest_oslomsg_notify_servers: >- + {{ + groups[trove_guest_notify_host_group] | map('extract', hostvars, 'ansible_facts') | map(attribute=trove_provider_net_iface | replace('-','_') + ) | map(attribute='ipv4.address') | join(',') + }} trove_guest_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl | default(False) }}" # Trove image settings. @@ -187,7 +214,12 @@ trove_guestagent_images: [] trove_guest_auth_url: "{{ keystone_service_publicurl }}" trove_guest_swift_url: "{{ trove_service_publicuri_proto }}://{{ external_lb_vip_address }}:{{ swift_proxy_port }}/v1/AUTH_" -trove_swift_enabled: "{{ (groups['swift_all'] is defined and groups['swift_all'] | length > 0) or (groups['ceph-rgw'] is defined and groups['ceph-rgw'] | length > 0) or (ceph_rgws is defined and ceph_rgws | length > 0) }}" +trove_swift_enabled: >- + {{ + (groups['swift_all'] is defined and groups['swift_all'] | length > 0) or + (groups['ceph-rgw'] is defined and groups['ceph-rgw'] | length > 0) or + (ceph_rgws is defined and ceph_rgws | length > 0) + }} trove_designate_enabled: "{{ (groups['designate_all'] is defined and groups['designate_all'] | length > 0) }}" trove_cinder_enabled: "{{ (groups['cinder_volume'] is defined and groups['cinder_volume'] | length > 0) }}" @@ -244,7 +276,7 @@ trove_service_user_domain_name: Default trove_service_project_domain_id: default trove_service_user_domain_id: default -#Glance images +# Glance images trove_glance_images: [] trove_pip_packages: @@ -347,5 +379,5 @@ trove_pki_install_certificates: mode: "0600" # Define user-provided SSL certificates -#trove_user_ssl_cert: -#trove_user_ssl_key: +# trove_user_ssl_cert: +# trove_user_ssl_key: diff --git a/meta/main.yml b/meta/main.yml index 5cccb9a..4a6eb47 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,24 +4,25 @@ galaxy_info: description: Deploy Trove with OpenStack Ansible company: OpenStack license: Apache-2.0 - min_ansible_version: 2.2 - version: 0.1.0 + min_ansible_version: "2.10" + role_name: os_trove + namespace: openstack platforms: - - name: Debian - versions: - - buster - - name: Ubuntu - versions: - - bionic - - focal - - name: EL - versions: - - 8 + - name: Debian + versions: + - bullseye + - name: Ubuntu + versions: + - focal + - jammy + - name: EL + versions: + - "9" galaxy_tags: - - cloud - - openstack - - python - - trove + - cloud + - openstack + - python + - trove dependencies: - role: apt_package_pinning diff --git a/tasks/main.yml b/tasks/main.yml index 64170bf..cfb9b32 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -40,7 +40,8 @@ tags: - always -- include_role: +- name: Including osa.db_setup role + include_role: name: openstack.osa.db_setup apply: tags: @@ -61,7 +62,8 @@ tags: - always -- include_role: +- name: Including osa.mq_setup role + include_role: name: openstack.osa.mq_setup apply: tags: @@ -83,7 +85,8 @@ tags: - always -- import_tasks: trove_pre_install.yml +- name: Importing trove_pre_install tasks + import_tasks: trove_pre_install.yml tags: - trove-install @@ -125,18 +128,21 @@ tags: - trove-install -- import_tasks: trove_service_network.yml +- name: Importing trove_service_network tasks + import_tasks: trove_service_network.yml tags: - trove-install - trove-config -- include_tasks: trove_guest_image.yml +- name: Including trove_guest_image tasks + include_tasks: trove_guest_image.yml when: trove_guestagent_images | length > 0 tags: - trove-install - trove-config -- import_tasks: trove_post_install.yml +- name: Importing trove_post_install tasks + import_tasks: trove_post_install.yml tags: - trove-install - trove-config @@ -150,10 +156,10 @@ systemd_tempd_prefix: openstack systemd_slice_name: trove systemd_lock_path: /var/lock/trove - systemd_CPUAccounting: true - systemd_BlockIOAccounting: true - systemd_MemoryAccounting: true - systemd_TasksAccounting: true + systemd_service_cpu_accounting: true + systemd_service_block_io_accounting: true + systemd_service_memory_accounting: true + systemd_service_tasks_accounting: true systemd_services: - service_name: "{{ service_var.service_name }}" enabled: yes @@ -179,7 +185,8 @@ - trove-config - uwsgi -- include_role: +- name: Including osa.service_setup role + include_role: name: openstack.osa.service_setup apply: tags: @@ -216,7 +223,8 @@ tags: - always -- import_tasks: trove_db_sync.yml +- name: Importing trove_db_sync tasks + import_tasks: trove_db_sync.yml when: _trove_conductor_is_first_play_host tags: - trove-install diff --git a/tasks/trove_guest_image.yml b/tasks/trove_guest_image.yml index 850ebcc..7f1658f 100644 --- a/tasks/trove_guest_image.yml +++ b/tasks/trove_guest_image.yml @@ -32,6 +32,7 @@ url: "{{ item.file }}" dest: "{{ trove_image_local_path }}/{{ item.file | basename }}" checksum: "{{ item.checksum | default(omit) }}" + mode: "0644" retries: 5 delay: 10 register: trove_download_images @@ -59,7 +60,7 @@ # This uses command since os_image doesn't support tags. # TODO(odyssey4me): # Add tag capability to os_image module and replace this. - - name: Upload new image to glance + - name: Upload new image to glance # noqa: no-changed-when jinja[spacing] command: >- openstack image create --os-cloud {{ item.cloud | default('default') }} diff --git a/tasks/trove_post_install.yml b/tasks/trove_post_install.yml index f39e793..7c12147 100644 --- a/tasks/trove_post_install.yml +++ b/tasks/trove_post_install.yml @@ -16,10 +16,10 @@ # (c) 2016 Donovan Francesco # (c) 2016 Paul Stevens -- name: Gathering network facts for {{ trove_provider_net_name }} interface +- name: Gathering network facts for interface {{ trove_provider_net_name }} setup: gather_subset: "!all,network" - filter: "{{ trove_address_gather_filter | default('ansible_' ~ trove_provider_net_iface | replace('-','_')) }}" + filter: "{{ trove_address_gather_filter | default('ansible_' ~ trove_provider_net_iface | replace('-', '_')) }}" delegate_to: "{{ item }}" delegate_facts: true with_items: "{{ (groups[trove_guest_rpc_host_group] + groups[trove_guest_notify_host_group]) | unique }}" diff --git a/tasks/trove_pre_install.yml b/tasks/trove_pre_install.yml index 5d00940..af4ed59 100644 --- a/tasks/trove_pre_install.yml +++ b/tasks/trove_pre_install.yml @@ -35,9 +35,9 @@ file: path: "{{ item.path }}" state: directory - owner: "{{ item.owner|default(trove_system_user_name) }}" - group: "{{ item.group|default(trove_system_group_name) }}" - mode: "{{ item.mode|default('0755') }}" + owner: "{{ item.owner | default(trove_system_user_name) }}" + group: "{{ item.group | default(trove_system_group_name) }}" + mode: "{{ item.mode | default('0755') }}" with_items: - { path: "/openstack/venvs", owner: "root", group: "root" } - { path: "/etc/trove" } diff --git a/vars/main.yml b/vars/main.yml index 8838508..0d363ed 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -13,8 +13,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -_trove_is_first_play_host: "{{ (trove_services['trove-api']['group'] in group_names and inventory_hostname == (groups[trove_services['trove-api']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" -_trove_conductor_is_first_play_host: "{{ (trove_services['trove-conductor']['group'] in group_names and inventory_hostname == (groups[trove_services['trove-conductor']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" +_trove_is_first_play_host: >- + {{ + (trove_services['trove-api']['group'] in group_names and + inventory_hostname == (groups[trove_services['trove-api']['group']] | intersect(ansible_play_hosts)) | first) | bool + }} +_trove_conductor_is_first_play_host: >- + {{ + (trove_services['trove-conductor']['group'] in group_names and + inventory_hostname == (groups[trove_services['trove-conductor']['group']] | intersect(ansible_play_hosts)) | first) | bool + }} filtered_trove_services: |- {% set services = [] %}