ansible-role-nginx/tasks/controller/install-controller.yml
2018-09-14 17:27:12 -07:00

43 lines
1.4 KiB
YAML

---
- import_tasks: setup-debian.yml
when: ansible_os_family == "Debian"
- import_tasks: setup-redhat.yml
when: ansible_os_family == "RedHat"
- name: "(Install: All OSs) Install NGINX Controller Agent"
package:
name: nginx-controller-agent
state: present
- name: "(Setup: All OSs) Copy NGINX Controller Agent Configuration Template"
copy:
remote_src: yes
src: /etc/controller-agent/agent.controller.conf.default
dest: /etc/controller-agent/agent.conf
- name: "(Setup: All OSs) Copy NGINX Configurator Agent Configuration Template"
copy:
remote_src: yes
src: /etc/controller-agent/agent.configurator.conf.default
dest: /etc/controller-agent/agent.configurator.conf
- name: "(Setup: All OSs) Configure NGINX Controller Agent API Key"
lineinfile:
dest: /etc/controller-agent/agent.conf
regexp: api_key =.*
line: "api_key = {{ nginx_controller_api_key }}"
- name: "(Setup: All OSs) Configure NGINX Controller Agent API URL"
lineinfile:
dest: /etc/controller-agent/agent.conf
regexp: api_url =.*
line: "api_url = {{ nginx_controller_api_endpoint }}"
- name: "(Setup: All OSs) Configure NGINX Controller Agent API Hostname"
lineinfile:
dest: /etc/controller-agent/agent.conf
regexp: hostname =.*
line: "hostname = {{ ansible_hostname }}"
notify: "(Handler: All OSs) Start NGINX Controller Agent"