| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| --- |
| - name: Create ambari-agent hostname script |
| template: |
| src: "../roles/ambari_slave/files/hostname.sh" |
| dest: "/var/lib/ambari-agent/hostname.sh" |
| mode: 0744 |
| owner: "{{ ambari_installation_user }}" |
| group: "{{ ambari_installation_user }}" |
| |
| - name: Configure ambari-server hostname in ambari-agent configuration |
| lineinfile: |
| dest: /etc/ambari-agent/conf/ambari-agent.ini |
| regexp: "{{ item.regexp }}" |
| line: "{{ item.line }}" |
| insertafter: "{{ item.insertafter }}" |
| backup: yes |
| with_items: |
| - { regexp: "^.*hostname=.*$", line: "hostname={{ groups.ambari_master[0] }}", insertafter: '\[server\]' } |
| - { regexp: "^hostname_script=.*$", line: "hostname_script=/var/lib/ambari-agent/hostname.sh", insertafter: '\[agent\]'} |