{"id":122,"sha1":"48f31bc94ba1be10d86762af20d40b593e1341ca","playbook":{"id":2,"items":{"plays":18,"tasks":316,"results":313,"hosts":2,"files":136,"records":0},"arguments":{"version":null,"verbosity":0,"private_key_file":null,"remote_user":null,"connection":"openstack.osa.ssh","timeout":null,"ssh_common_args":null,"sftp_extra_args":null,"scp_extra_args":null,"ssh_extra_args":null,"ask_pass":false,"connection_password_file":null,"force_handlers":true,"flush_cache":false,"become":false,"become_method":"sudo","become_user":null,"become_ask_pass":false,"become_password_file":null,"tags":["all"],"skip_tags":[],"check":false,"diff":false,"inventory":["/home/zuul/src/opendev.org/openstack/openstack-ansible/inventory/dynamic_inventory.py","/home/zuul/src/opendev.org/openstack/openstack-ansible/inventory/inventory.ini","/etc/openstack_deploy/inventory.ini"],"listhosts":false,"subset":null,"extra_vars":"Not saved by ARA as configured by 'ignored_arguments'","vault_ids":[],"ask_vault_pass":false,"vault_password_files":[],"forks":8,"module_path":null,"syntax":false,"listtasks":false,"listtags":false,"step":false,"start_at_task":null,"args":["setup-hosts.yml"]},"labels":[{"id":1,"name":"check:False"},{"id":2,"name":"tags:all"}],"started":"2025-12-08T13:27:39.675908Z","ended":"2025-12-08T13:33:13.621332Z","duration":"00:05:33.945424","name":null,"ansible_version":"2.18.6","client_version":"1.7.4","python_version":"3.12.3","server_version":"1.7.4","status":"completed","path":"/home/zuul/src/opendev.org/openstack/openstack-ansible/playbooks/setup-hosts.yml","controller":"aio1.openstack.local","user":"root"},"content":"---\n# Copyright 2014, Rackspace US, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n- name: Generate hosts file records\n  run_once: true\n  ansible.builtin.set_fact:\n    _etc_hosts_content: |-\n      {% set records = [] %}\n      {% set _groups = groups['all'] %}\n      {% set _ = _groups.remove('localhost') %}\n      {% for item in _groups %}\n      {%   set record = [] %}\n      {%   set _target_rfc_name = item|replace('_', '-') %}\n      {%   set _ans_hostname = hostvars[item]['ansible_facts']['hostname'] | default(_target_rfc_name) %}\n      {%   set _ = record.append(hostvars[item]['ansible_host'] | default('127.0.0.1')) %}\n      {%   set _ = record.append(_ans_hostname ~ '.' ~ openstack_domain) %}\n      {%   set _ = record.append(_target_rfc_name) %}\n      {%   if (_ans_hostname != _target_rfc_name) and (_target_rfc_name != item) %}\n      {%     set _ = record.append(item) %}\n      {%     set _ = record.append(_ans_hostname) %}\n      {%   elif (_ans_hostname != _target_rfc_name) and (_target_rfc_name == item) %}\n      {%     set _ = record.append(_ans_hostname) %}\n      {%   elif (_ans_hostname == _target_rfc_name) and (_target_rfc_name != item) %}\n      {%     set _ = record.append(item) %}\n      {%   endif %}\n      {%   set _ = records.append(record | join(' ')) %}\n      {% endfor %}\n      {{ records }}\n\n- name: Update hosts file\n  ansible.builtin.blockinfile:\n    dest: /etc/hosts\n    block: \"{{ (_etc_hosts_content + openstack_host_custom_hosts_records) | join('\\n') }}\"\n    marker: \"### {mark} OPENSTACK-ANSIBLE MANAGED BLOCK ###\"\n  when:\n    - openstack_host_manage_hosts_file | bool\n\n- name: Update hosts file on deploy host\n  ansible.builtin.blockinfile:\n    dest: /etc/hosts\n    block: \"{{ (_etc_hosts_content + openstack_host_custom_hosts_records) | join('\\n') }}\"\n    marker: \"### {mark} OPENSTACK-ANSIBLE {{ lookup('env', 'OSA_CONFIG_DIR') }} MANAGED BLOCK ###\"\n  run_once: true\n  delegate_to: localhost\n  become: true\n  when:\n    - openstack_host_manage_deploy_hosts_file | bool\n","created":"2025-12-08T13:29:50.695417Z","updated":"2025-12-08T13:29:50.695455Z","path":"/home/zuul/src/opendev.org/openstack/openstack-ansible-openstack_hosts/tasks/openstack_update_hosts_file.yml"}