deploy_customer_configuration.yml 14.5 KB
---
- hosts: dhipaya-prd
  become: true
  vars:
        dmapublishURL: 'publishUrl = https://tipeasy.dhipaya.co.th'
        wdchatpublishURL: https://tipsocial.dhipaya.co.th
        updateURL: https://tipsocial.dhipaya.co.th:444/index.html
        dmaserverName: 'server_name tipeasy.dhipaya.co.th;'
        wdchatserverName: 'server_name tipsocial.dhipaya.co.th;'
        hostName: wdchat
        etcHost: '127.0.0.1 wdchatgateway localhost wdchatengine wdchat'
  tasks:
      - file:
            path: /opt/stack/dma/conf/dmaconfig.properties
            state: touch
            mode: 0644
      - name:  Update DMA publish URL
        copy: content="{{ dmapublishURL }}" dest=/opt/stack/dma/conf/dmaconfig.properties
      
      - name:  Update NginX DMA server name
        copy: content="{{ dmaserverName }}" dest=/opt/stack/nginx/conf/dmadomain.conf
        
      - name:  Update NginX WDCHAT server name
        copy: content="{{ wdchatserverName }}" dest=/opt/stack/nginx/conf/wdchatdomain.conf
        
      - name: Update publish url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ wdchatpublishURL }}' where sys_group ='system' and sys_key = 'publish_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      - name: Update application download url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ updateURL }}' where sys_group ='appversion' and sys_key = 'update_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
                
      - name: Configure hostname
        hostname: name={{ hostName }}
      
      - name: Configure /etc/hosts
        lineinfile:
            path: /etc/hosts
            regexp: '^127\.0\.0\.1'
            line: "{{ etcHost }}"
            owner: root
            group: root
            mode: 0644
            
      - name: Update Customer WDCHAT Theme
        expect: 
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -f /tmp/tipsocial/wdchat_theme.sql
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
                
      - name: Deploy Customer iChatWeb.war
        command: cp /tmp/tipsocial/iChatWeb.war /opt/stack/runtime/wildfly/standalone/deployments/iChatWeb.war

- hosts: dhipaya-dev
  become: true
  vars:
        dmapublishURL: 'publishUrl = https://tipeasydev.dhipaya.co.th'
        wdchatpublishURL: https://tipsocialdev.dhipaya.co.th
        updateURL: https://tipsocialdev.dhipaya.co.th:444/index.html
        dmaserverName: 'server_name tipeasydev.dhipaya.co.th;'
        wdchatserverName: 'server_name ;'
        hostName: wdchat
        etcHost: '127.0.0.1 wdchatgateway localhost wdchatengine wdchat'
       
  tasks:
      - file:
            path: /opt/stack/dma/conf/dmaconfig.properties
            state: touch
            mode: 0644
      - name:  Update DMA publish URL
        copy: content="{{ dmapublishURL }}" dest=/opt/stack/dma/conf/dmaconfig.properties
      
      - name:  Update NginX DMA server name
        copy: content="{{ dmaserverName }}" dest=/opt/stack/nginx/conf/dmadomain.conf
        
      - name:  Update NginX WDCHAT server name
        copy: content="{{ wdchatserverName }}" dest=/opt/stack/nginx/conf/wdchatdomain.conf
        
      - name: Update publish url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ wdchatpublishURL }}' where sys_group ='system' and sys_key = 'publish_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      - name: Update application download url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ updateURL }}' where sys_group ='appversion' and sys_key = 'update_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'

      - name: Configure hostname
        hostname: name={{ hostName }}
      
      - name: Configure /etc/hosts
        lineinfile:
            path: /etc/hosts
            regexp: '^127\.0\.0\.1'
            line: "{{ etcHost }}"
            owner: root
            group: root
            mode: 0644
                
- hosts: blueprint
  become: true
  vars:
        dmapublishURL: 'publishUrl = https://bpdma.beebuddy.net'
        wdchatpublishURL: https://bpchat.beebuddy.net
        updateURL: https://bpchat.beebuddy.net:444/index.html
        dmaserverName: 'server_name bpdma.beebuddy.net;'
        wdchatserverName: 'server_name bpchat.beebuddy.net;'
        hostName: wdchat
        etcHost: '127.0.0.1 wdchatgateway localhost wdchatengine wdchat'
  tasks:
      - file:
            path: /opt/stack/dma/conf/dmaconfig.properties
            state: touch
            mode: 0644
      - name:  Update DMA publish URL
        copy: content="{{ dmapublishURL }}" dest=/opt/stack/dma/conf/dmaconfig.properties
      
      - name:  Update NginX DMA server name
        copy: content="{{ dmaserverName }}" dest=/opt/stack/nginx/conf/dmadomain.conf
        
      - name:  Update NginX WDCHAT server name
        copy: content="{{ wdchatserverName }}" dest=/opt/stack/nginx/conf/wdchatdomain.conf
        
      - name: Update publish url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ wdchatpublishURL }}' where sys_group ='system' and sys_key = 'publish_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      - name: Update application download url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ updateURL }}' where sys_group ='appversion' and sys_key = 'update_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      
      - name: Configure hostname
        hostname: name={{ hostName }}
      
      - name: Configure /etc/hosts
        lineinfile:
            path: /etc/hosts
            regexp: '^127\.0\.0\.1'
            line: "{{ etcHost }}"
            owner: root
            group: root
            mode: 0644
            
      - name: Update Theme
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -f /tmp/blueprint/wdchat_theme.sql
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      
      - name: Deploy Customer iChatWeb.war
        command: cp /tmp/blueprint/iChatWeb.war /opt/stack/runtime/wildfly/standalone/deployments/iChatWeb.war

            
- hosts: beebuddy
  become: true
  vars:
        dmapublishURL: 'publishUrl = https://bbdma.beebuddy.net'
        wdchatpublishURL: https://bbchat.beebuddy.net
        updateURL: https://bbchat.beebuddy.net:444/index.html
        dmaserverName: 'server_name bbdma.beebuddy.net;'
        wdchatserverName: 'server_name bbchat.beebuddy.net;'
        hostName: wdchat
        etcHost: '127.0.0.1 wdchatgateway localhost wdchatengine wdchat'
  tasks:
      - file:
            path: /opt/stack/dma/conf/dmaconfig.properties
            state: touch
            mode: 0644
      - name:  Update DMA publish URL
        copy: content="{{ dmapublishURL }}" dest=/opt/stack/dma/conf/dmaconfig.properties
      
      - name:  Update NginX DMA server name
        copy: content="{{ dmaserverName }}" dest=/opt/stack/nginx/conf/dmadomain.conf
        
      - name:  Update NginX WDCHAT server name
        copy: content="{{ wdchatserverName }}" dest=/opt/stack/nginx/conf/wdchatdomain.conf
        
      - name: Update publish url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ wdchatpublishURL }}' where sys_group ='system' and sys_key = 'publish_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      - name: Update application download url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ updateURL }}' where sys_group ='appversion' and sys_key = 'update_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      
      - name: Configure hostname
        hostname: name={{ hostName }}
      
      - name: Configure /etc/hosts
        lineinfile:
            path: /etc/hosts
            regexp: '^127\.0\.0\.1'
            line: "{{ etcHost }}"
            owner: root
            group: root
            mode: 0644
            
      - name: Update Theme
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -f /tmp/beebuddy/wdchat_theme.sql
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      
      - name: Deploy Customer iChatWeb.war
        command: cp /tmp/beebuddy/iChatWeb.war /opt/stack/runtime/wildfly/standalone/deployments/iChatWeb.war
            
- hosts: ptychat
  become: true
  vars:
        dmapublishURL: 'publishUrl = https://'
        wdchatpublishURL: https://pty-chat.partsoto.net
        updateURL: https://pty-chat.partsoto.net:444/index.html
        dmaserverName: 'server_name ;'
        wdchatserverName: 'server_name pty-chat.partsoto.net;'
        hostName: wdchat
        etcHost: '127.0.0.1 wdchatgateway localhost wdchatengine wdchat'
  tasks:
      - file:
            path: /opt/stack/dma/conf/dmaconfig.properties
            state: touch
            mode: 0644
      - name:  Update DMA publish URL
        copy: content="{{ dmapublishURL }}" dest=/opt/stack/dma/conf/dmaconfig.properties
      
      - name:  Update NginX DMA server name
        copy: content="{{ dmaserverName }}" dest=/opt/stack/nginx/conf/dmadomain.conf
        
      - name:  Update NginX WDCHAT server name
        copy: content="{{ wdchatserverName }}" dest=/opt/stack/nginx/conf/wdchatdomain.conf
        
      - name: Update publish url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ wdchatpublishURL }}' where sys_group ='system' and sys_key = 'publish_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      - name: Update application download url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ updateURL }}' where sys_group ='appversion' and sys_key = 'update_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      
      - name: Configure hostname
        hostname: name={{ hostName }}
      
      - name: Configure /etc/hosts
        lineinfile:
            path: /etc/hosts
            regexp: '^127\.0\.0\.1'
            line: "{{ etcHost }}"
            owner: root
            group: root
            mode: 0644
            
      - name: Update Theme
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -f /tmp/ptychat/wdchat_theme.sql
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      
      - name: Deploy Customer iChatWeb.war
        command: cp /tmp/ptychat/iChatWeb.war /opt/stack/runtime/wildfly/standalone/deployments/iChatWeb.war

- hosts: scgchat
  become: true
  vars:
        dmapublishURL: 'publishUrl = https://;'
        wdchatpublishURL: https://scgchat.beebuddy.net
        updateURL: https://scgchat.beebuddy.net:444/index.html
        dmaserverName: 'server_name ;'
        wdchatserverName: 'server_name scgchat.beebuddy.net;'
        hostName: wdchat
        etcHost: '127.0.0.1 wdchatgateway localhost wdchatengine wdchat'
  tasks:
      - file:
            path: /opt/stack/dma/conf/dmaconfig.properties
            state: touch
            mode: 0644
      - name:  Update DMA publish URL
        copy: content="{{ dmapublishURL }}" dest=/opt/stack/dma/conf/dmaconfig.properties
      
      - name:  Update NginX DMA server name
        copy: content="{{ dmaserverName }}" dest=/opt/stack/nginx/conf/dmadomain.conf
        
      - name:  Update NginX WDCHAT server name
        copy: content="{{ wdchatserverName }}" dest=/opt/stack/nginx/conf/wdchatdomain.conf
        
      - name: Update publish url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ wdchatpublishURL }}' where sys_group ='system' and sys_key = 'publish_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      - name: Update application download url
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -c "update wd_sys_config set sys_value = '{{ updateURL }}' where sys_group ='appversion' and sys_key = 'update_url'"
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
                
      - name: Configure hostname
        hostname: name={{ hostName }}
      
      - name: Configure /etc/hosts
        lineinfile:
            path: /etc/hosts
            regexp: '^127\.0\.0\.1'
            line: "{{ etcHost }}"
            owner: root
            group: root
            mode: 0644
      
      - name: Update Theme
        expect:
            command: /opt/stack/postgres/postgresql/bin/psql --host=127.0.0.1 --port=7432 --username=wdchat -d WDCHAT -f /tmp/scgchat/wdchat_theme.sql
            responses:
                'Password for user wdchat': 'BBRyAPNh6g4H9qte'
      
      - name: Deploy Customer iChatWeb.war
        command: cp /tmp/scgchat/iChatWeb.war /opt/stack/runtime/wildfly/standalone/deployments/iChatWeb.war
      
      - name: Deploy Customer iChatGateway.war
        command: cp /tmp/scgchat/iChatGateway.war /opt/stack/runtime/wildfly/standalone/deployments/iChatGateway.war