diff options
Diffstat (limited to 'supporting/servers')
-rw-r--r-- | supporting/servers/ansible.cfg | 3 | ||||
-rw-r--r-- | supporting/servers/elk.yml | 4 | ||||
-rw-r--r-- | supporting/servers/inventory | 4 | ||||
-rw-r--r-- | supporting/servers/roles/elk/defaults/main.yml | 4 | ||||
-rw-r--r-- | supporting/servers/roles/elk/handlers/main.yml | 8 | ||||
-rw-r--r-- | supporting/servers/roles/elk/tasks/main.yml | 60 | ||||
-rw-r--r-- | supporting/servers/roles/elk/templates/elk.conf.j2 | 14 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/defaults/main.yml | 5 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/files/serena.authorized_keys | 1 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/files/taseer.authorized_keys | 1 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/files/yujunz.authorized_keys | 1 | ||||
-rw-r--r-- | supporting/servers/roles/ssh/tasks/main.yml | 26 | ||||
-rw-r--r-- | supporting/servers/ssh.yml | 4 |
13 files changed, 135 insertions, 0 deletions
diff --git a/supporting/servers/ansible.cfg b/supporting/servers/ansible.cfg new file mode 100644 index 00000000..93022c4e --- /dev/null +++ b/supporting/servers/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] +hostfile = inventory +host_key_checking = False
\ No newline at end of file diff --git a/supporting/servers/elk.yml b/supporting/servers/elk.yml new file mode 100644 index 00000000..406ba93f --- /dev/null +++ b/supporting/servers/elk.yml @@ -0,0 +1,4 @@ +--- +- hosts: elk-servers + roles: + - elk diff --git a/supporting/servers/inventory b/supporting/servers/inventory new file mode 100644 index 00000000..aa9388fe --- /dev/null +++ b/supporting/servers/inventory @@ -0,0 +1,4 @@ +qtip-dev ansible_host=qtip + +[elk-servers] +qtip-dev
\ No newline at end of file diff --git a/supporting/servers/roles/elk/defaults/main.yml b/supporting/servers/roles/elk/defaults/main.yml new file mode 100644 index 00000000..855fc7ea --- /dev/null +++ b/supporting/servers/roles/elk/defaults/main.yml @@ -0,0 +1,4 @@ +--- +services: + - { name: kibana, upstream: 'http://127.0.0.1:5601' } + - { name: elastic, upstream: 'http://127.0.0.1:9200' } diff --git a/supporting/servers/roles/elk/handlers/main.yml b/supporting/servers/roles/elk/handlers/main.yml new file mode 100644 index 00000000..46bd76c7 --- /dev/null +++ b/supporting/servers/roles/elk/handlers/main.yml @@ -0,0 +1,8 @@ +--- +- name: starting docker service + become: true + service: name=docker state=started + +- name: restart nginx + become: true + service: name=nginx state=restarted diff --git a/supporting/servers/roles/elk/tasks/main.yml b/supporting/servers/roles/elk/tasks/main.yml new file mode 100644 index 00000000..7628f378 --- /dev/null +++ b/supporting/servers/roles/elk/tasks/main.yml @@ -0,0 +1,60 @@ +--- +- name: adding keys + become: true + apt_key: keyserver=hkp://p80.pool.sks-keyservers.net id=0X58118E89F3A912897C070ADBF76221572C52609D + +- name: adding entry for ubuntu + become: true + apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-xenial main' state=present filename='docker' + when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "16.04" + +- name: installing from docker repo + become: true + shell: apt-cache policy docker-engine + when: ansible_distribution == "Ubuntu" and ansible_distribution_version== "16.04" + +- name: adding entry for ubuntu + become: true + apt_repository: repo='deb https://apt.dockerproject.org/repo ubuntu-trusty main' state=present filename='docker' + when: ansible_distribution == "Ubuntu" and ansible_distribution_version == "14.04" + +- name: updating + become: true + apt: update_cache=yes + +- name: installing docker engine + become: true + apt: name=docker-engine + +- name: pulling elasticsearch and kibana + become: true + docker_image: name={{ item }} state=present + with_items: + - elasticsearch + - kibana + +- name: setting up elasticsearch + become: true + docker_container: + name: esearch + image: elasticsearch + published_ports: 9200:9200 + +- name: setting up kibana + become: true + docker_container: + name: kibana + image: kibana + published_ports: 5601:5601 + links: esearch:elasticsearch + +- name: nginx is installed + become: true + package: name=nginx state=present +- name: qtip server configuration is generated + become: true + template: src={{ item }}.conf.j2 dest=/etc/nginx/sites-enabled/{{ item }}.conf + with_items: + - elk + notify: + - restart nginx diff --git a/supporting/servers/roles/elk/templates/elk.conf.j2 b/supporting/servers/roles/elk/templates/elk.conf.j2 new file mode 100644 index 00000000..271690e0 --- /dev/null +++ b/supporting/servers/roles/elk/templates/elk.conf.j2 @@ -0,0 +1,14 @@ +# {{ ansible_managed }} + +# servers +# +{% for service in services %} +server { + listen 80; + listen 443 ssl; + server_name {{ service.name }}.qtip.openzero.net; + location / { + proxy_pass {{ service.upstream }}; + } +} +{% endfor %} diff --git a/supporting/servers/roles/ssh/defaults/main.yml b/supporting/servers/roles/ssh/defaults/main.yml new file mode 100644 index 00000000..59dfd086 --- /dev/null +++ b/supporting/servers/roles/ssh/defaults/main.yml @@ -0,0 +1,5 @@ +--- +users: + - { name: yujunz, comment: "Yujun Zhang <zhang.yujunz@zte.com.cn>" } + - { name: taseer, comment: "Taseer Ahmed <taseer94@gmail.com>" } + - { name: serena, comment: "Serena Feng <feng.xiaowei@zte.com.cn>" } diff --git a/supporting/servers/roles/ssh/files/serena.authorized_keys b/supporting/servers/roles/ssh/files/serena.authorized_keys new file mode 100644 index 00000000..5cdbfe00 --- /dev/null +++ b/supporting/servers/roles/ssh/files/serena.authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYlLrMOPxwLNQvLpxXVLYXQCxNkaKfVWt7u9k+6T0SU7VNuT8e1VoTk6b/iVWyXQ4j1hW4sNroTucqZjl+8V2z2nYgpEMIy6jBuehlKP2LJ9v/p98/OBVVxgEnRJGzFYIeO/GKBLMaUu43OkCO2Ef67qKeISeNP5/ewUR12YCUHQg5GkGYnDL3fFd7SiVDkYPEXQvHfi85beGOuPwDTjbKoKbF9WATIIzJSPUmslGjFRpKqM8AQLGWEyTeklU7H4ddRqaKxe6DGbpTLJM2rCMF8W91097nmiOKEnuxi6vJKTmyX81BZXi48ugCRh3942ONYRH8W7dBegrvRY3kyAtH root@gsmdev-VirtualBox diff --git a/supporting/servers/roles/ssh/files/taseer.authorized_keys b/supporting/servers/roles/ssh/files/taseer.authorized_keys new file mode 100644 index 00000000..2efb95e8 --- /dev/null +++ b/supporting/servers/roles/ssh/files/taseer.authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCxCG9Z+8rBLQiJ9yt+RzRkAZZQIlou83e899Kkuf/UgXd+1TUgIu4AJUDvayrorTxk2kw7ra+DoysEa2NBkLL6FNnG+NpYV+XTaG+Z3tvp4l62ROV+5+O4soiWtBroRghQPDkrpiTQuFJ7/BKQt9bKZYPb3t2bxCLeFVWtUzCpFDIj6wDPGwDeTLnLMPtQNQtIlgPV+XGAet17rNSrm7EcDzqdDQcdZFmfeH5YvBsY9ZO+qwcbelEpMBWPsyEMU6OgwTqUj7mm3o+Quew35y13Zrhf+GAx5ZMXho/Cpjp1TzognDkwAFpFzZG7zWSNexXrD15Wzgyae2cl/vD75I7 taseer@123.org
\ No newline at end of file diff --git a/supporting/servers/roles/ssh/files/yujunz.authorized_keys b/supporting/servers/roles/ssh/files/yujunz.authorized_keys new file mode 100644 index 00000000..168979c3 --- /dev/null +++ b/supporting/servers/roles/ssh/files/yujunz.authorized_keys @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0o+WARhbI5DeZK9eiZKVprY3oQ910npo/EPFI9prfpN7zeF0UA4TwT9rqsrwFgRQeJkKvbDTOPt5Ox9vLIEnxT4PdirvrYNxtyJHHfbL4ZxKemYhBi2BA6CAbI3f9CR+dtbfOBxtTpXAj1Y5oA9y59o1hqHpuVmM8dBpcQt/ELdYCHZ0khxft5WaSOURsslTZN18bikVX9WHlKflVyRA8efxqzTZ4w5ufHl1Fv9i/G0u7iGbUtvlI8X7+Z+ePuysZhHKErQSGfv2NybDi+r8xM5hL2LYXxjAu0PV58olUl1SX40OY9yA2Yx+PVzIGhv6EQ8snUFnsoMy0ZIbQ+ysB yujunz@silver.mbp diff --git a/supporting/servers/roles/ssh/tasks/main.yml b/supporting/servers/roles/ssh/tasks/main.yml new file mode 100644 index 00000000..7de1e208 --- /dev/null +++ b/supporting/servers/roles/ssh/tasks/main.yml @@ -0,0 +1,26 @@ +- name: add users for ssh access + become: true + user: + name: "{{ item.name }}" + comment: "{{ item.comment }}" + groups: "qtip" + append: yes + with_items: "{{ users }}" +- name: create .ssh directory + become: true + file: + path: "/home/{{ item.name }}/.ssh" + state: directory + owner: "{{ item.name }}" + group: "{{ item.name }}" + mode: 0700 + with_items: "{{ users }}" +- name: authorize public key + become: true + copy: + src: "{{ item.name }}.authorized_keys" + dest: "/home/{{ item.name }}/.ssh/authorized_keys" + owner: "{{ item.name }}" + group: "{{ item.name }}" + mode: 0600 + with_items: "{{ users }}"
\ No newline at end of file diff --git a/supporting/servers/ssh.yml b/supporting/servers/ssh.yml new file mode 100644 index 00000000..bd74ab3b --- /dev/null +++ b/supporting/servers/ssh.yml @@ -0,0 +1,4 @@ +--- +- hosts: elk-servers + roles: + - ssh |