--- # update mesh.properties with the mesh_node_name from the tag in mesh_vol_info - name: enforce node.name per volume tag ansible.builtin.lineinfile: line: node.name={{ mesh_node_name }} path: "{{ mesh_properties_file }}" regexp: '^node\.name=' - name: enforce node.rpc-url per node_name ansible.builtin.lineinfile: path: "{{ mesh_properties_file }}" search_string: 'node.rpc-url=' line: node.rpc-url={{ mesh_node_scheme }}://{{ mesh_node_name }}.{{ stack_name }}-{{ ansible_ec2_placement_region }}.{{ atl_hostedzone }}:{{ mesh_node_port }} - name: enforce metrics.tags.host per volume tag ansible.builtin.lineinfile: path: "{{ mesh_properties_file }}" search_string: 'metrics.tags.host=' line: metrics.tags.host={{ mesh_node_name }} # the idea here is that the pet name will persist through clones, and just the stack_name - region part of the url will change (and maybe the hosted zone) - name: create r53 entry for this mesh node based on the mesh_node_name amazon.aws.route53: command: create zone: "{{ atl_hostedzone }}" record: "{{ mesh_node_name }}.{{ stack_name }}-{{ ansible_ec2_placement_region }}.{{ atl_hostedzone }}" type: A ttl: 300 value: "{{ ansible_default_ipv4.address }}" overwrite: "yes" private_zone: "yes" when: - ansible_default_ipv4.address | ansible.utils.ipaddr - mesh_vol is regex('^vol-.*') tags: notest # doesn't work in molecule - name: build a dict of tags from the ec2 instance to apply to the ebs volume ansible.builtin.set_fact: ebs_tags: "{{ ebs_tags | default({}) | combine({item.key: item.value}) }}" when: - item.key not in ['Name'] - item.key is not match("aws:.*") with_dict: "{{ ec2_instance_tags }}" - name: apply the tags from the ec2 instance to the ebs volume amazon.aws.ec2_tag: region: "{{ ansible_ec2_placement_region }}" resource: "{{ ((mesh_vol is defined) and (mesh_vol | length > 0)) | ternary(mesh_vol, mesh_vol_info.volume.id) }}" tags: "{{ ebs_tags }}" state: present purge_tags: false tags: notest # doesn't work in molecule - name: add the mesh_node_name tag to the ebs volume and current ec2 amazon.aws.ec2_tag: region: "{{ ansible_ec2_placement_region }}" resource: "{{ item }}" tags: mesh_node_name: "{{ mesh_node_name }}" state: present purge_tags: false tags: notest # doesn't work in molecule with_items: - "{{ ((mesh_vol is defined) and (mesh_vol | length > 0)) | ternary(mesh_vol, mesh_vol_info.volume.id) }}" - "{{ ansible_ec2_instance_id }}"