ansible-role-nginx/tasks/controller/install-controller.yml
2018-09-11 11:26:56 -07:00

43 lines
1.3 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 = {{ 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 = {{ 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"