diff --git a/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/tasks/main.yml b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/tasks/main.yml new file mode 100644 index 000000000..da15a8cc7 --- /dev/null +++ b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/tasks/main.yml @@ -0,0 +1,117 @@ +--- +- name: update system. + shell: sudo apt update + become: yes + +- name: Install ats + apt: + name: ['trafficserver'] + update_cache: yes + state: latest + become: yes + when: ansible_pkg_mgr == 'apt' + +- name: Install Apache2 + apt: + name: ['apache2'] + update_cache: yes + state: latest + become: yes + +- name: Start apache2 service + shell: "sudo systemctl start apache2" + become: yes + when: ansible_pkg_mgr == 'apt' + +- name: set apache ports config + lineinfile: + path: "/etc/apache2/ports.conf" + state: present + regexp: "80" + line: "Listen 127.0.0.1:80" + become: true + no_log: true + +- name: set apache ports config + lineinfile: + path: "/etc/apache2/apache2.conf" + line: "ServerName localhost" + state: present + become: true + no_log: true + +- name: Configuring Traffic Server as a Reverse Proxy + lineinfile: + path: "/etc/trafficserver/remap.config" + line: "map http://13.233.89.63:8080/ http://127.0.0.1:80/" + state: present + become: true + no_log: true + +- name: enabling ATS metrics + lineinfile: + path: "/etc/trafficserver/plugin.config" + line: "stats_over_http.so" + state: present + become: true + no_log: true + +- name: enabling ATS metrics setup + lineinfile: + path: "/etc/trafficserver/records.config" + line: "CONFIG proxy.config.http.cache.http INT 1 + + CONFIG proxy.config.reverse_proxy.enabled INT 1 + + CONFIG proxy.config.url_remap.remap_required INT 1 + + CONFIG proxy.config.url_remap.pristine_host_hdr INT 1 + + CONFIG proxy.config.http.server_ports STRING 8080 8080:ipv6" + state: present + become: true + no_log: true + +- name: Start apache2 service + shell: "systemctl restart apache2" + become: yes + when: ansible_pkg_mgr == 'apt' + +- name: creating ats run directory + shell: mkdir -p /var/run/trafficserver + become: true + +- name: give permission to ats + shell: chown -R trafficserver:trafficserver /var/run/trafficserver + become: true + +- name: Start trafficserver service + shell: "systemctl restart trafficserver" + become: yes + when: ansible_pkg_mgr == 'apt' + +- block: + - name: Copy nri-flex config file + template: + src: nri-flex-ats.yml + dest: /etc/newrelic-infra/integrations.d/nri-flex-ats.yml + become: true + +- block: + - name: Copy nri-flex config file + template: + src: nri-flex-ats-cache.yml + dest: /etc/newrelic-infra/integrations.d/nri-flex-ats-cache.yml + become: true + +- block: + - name: Copy nri-flex config file + template: + src: nri-flex-ats-http.yml + dest: /etc/newrelic-infra/integrations.d/nri-flex-ats-http.yml + become: true + +- name: Restart the newrelic-infra service + shell: "systemctl restart newrelic-infra.service" + become: yes + when: ansible_pkg_mgr == 'apt' diff --git a/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats-cache.yml b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats-cache.yml new file mode 100644 index 000000000..28235e0ad --- /dev/null +++ b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats-cache.yml @@ -0,0 +1,10 @@ +integrations: + - name: nri-flex + interval: 30s + config: + name: ATSCacheMetrics + apis: + - event_type: ATSCacheSampleMetrics + url: http://localhost:8080/_stats + keep_keys: + - cache \ No newline at end of file diff --git a/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats-http.yml b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats-http.yml new file mode 100644 index 000000000..966fa386e --- /dev/null +++ b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats-http.yml @@ -0,0 +1,10 @@ +integrations: + - name: nri-flex + interval: 30s + config: + name: ApcheTrafficServerMetrics + apis: + - event_type: ATSHttpSampleMetrics + url: http://localhost:8080/_stats + keep_keys: + - http \ No newline at end of file diff --git a/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats.yml b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats.yml new file mode 100644 index 000000000..4c099328e --- /dev/null +++ b/test/deploy/linux/apache-traffic-server/install/linux/roles/configure/templates/nri-flex-ats.yml @@ -0,0 +1,11 @@ +integrations: + - name: nri-flex + interval: 30s + config: + name: ATSAutomationMetrics + apis: + - event_type: ATSAutomationMetrics + url: http://localhost:8080/_stats + remove_keys: + - http + - cache \ No newline at end of file diff --git a/test/manual/definitions/ohi-auto-config/linux/apache-traffic-server-ubuntu-auto.json b/test/manual/definitions/ohi-auto-config/linux/apache-traffic-server-ubuntu-auto.json new file mode 100644 index 000000000..0f003f0bc --- /dev/null +++ b/test/manual/definitions/ohi-auto-config/linux/apache-traffic-server-ubuntu-auto.json @@ -0,0 +1,45 @@ +{ + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + + "resources": [ + { + "id": "amubuntu22auto", + "provider": "aws", + "type": "ec2", + "size": "t3.micro", + "ami_name": "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-????????", + "user_name": "ubuntu" + } + ], + + "instrumentations": { + "resources": [ + { + "id": "nr_infra_ubuntu22", + "resource_ids": ["amubuntu22auto"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install/roles", + "params": { + "validate_output": "Infrastructure Agent\\s+\\(installed\\)", + "local_recipes": true + } + } + ] + }, + + "services": [ + { + "id": "ats", + "destinations": ["amubuntu22auto"], + "local_source_path": "/mnt/deployer", + "deploy_script_path": "test/deploy/linux/apache-traffic-server/install/linux/roles", + "port": 8080 + } + ] +}