testernode.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. ---
  2. - hosts: all
  3. become: yes
  4. become_user: root
  5. become_method: sudo
  6. gather_facts: yes
  7. vars:
  8. deb_packages:
  9. - build-essential
  10. - autoconf
  11. - automake
  12. - libbsd-dev
  13. - libltdl-dev
  14. - libltdl7
  15. - libtool
  16. - libevent-openssl-2.1-6
  17. - libpcre3-dev
  18. - libevent-dev
  19. - pkg-config
  20. - zlib1g-dev
  21. - libssl-dev
  22. - nginx
  23. handlers:
  24. - name: restart_nginx
  25. service:
  26. name: nginx
  27. state: restarted
  28. pre_tasks:
  29. - name: Update Apt Cache
  30. apt: update_cache=yes
  31. when: ansible_os_family == "Debian"
  32. - name: Ubuntu Packages
  33. package:
  34. name: "{{ deb_packages }}"
  35. - name: Set to Realistic Hostname
  36. hostname:
  37. name: "tester"
  38. - name: Setup Hostsfile
  39. lineinfile:
  40. dest: /etc/hosts
  41. regexp: '^127\.0\.0\.1[ \t]+localhost'
  42. line: "127.0.0.1 localhost tester"
  43. state: present
  44. tasks:
  45. - name: load vars
  46. include_vars: default.yaml
  47. - name: create redis user
  48. user:
  49. name: redis
  50. uid: 4001
  51. shell: /bin/bash
  52. state: present
  53. - name: checkout redis git repo
  54. git:
  55. repo: 'https://github.com/antirez/redis'
  56. dest: /home/redis/redis
  57. - name: redis - Build the default target
  58. make:
  59. chdir: /home/redis/redis
  60. - name: redis - Run 'install' target as root
  61. make:
  62. chdir: /home/redis/redis
  63. target: install
  64. become: yes
  65. - name: checkout memtier_benchmark git repo
  66. git:
  67. repo: 'https://github.com/RedisLabs/memtier_benchmark'
  68. dest: /home/redis/memtier_benchmark
  69. - name: memtier - Run the autoconf
  70. command: autoreconf -ivf
  71. args:
  72. chdir: /home/redis/memtier_benchmark
  73. creates: /home/redis/memtier_benchmark/configure
  74. - name: memtier - Run the configure script first
  75. command: ./configure
  76. args:
  77. chdir: /home/redis/memtier_benchmark
  78. creates: /home/redis/memtier_benchmark/Makefile
  79. - name: memtier - Build the default target
  80. make:
  81. chdir: /home/redis/memtier_benchmark
  82. - name: Run 'memtier_benchmark install' target as root
  83. make:
  84. chdir: /home/redis/memtier_benchmark
  85. target: install
  86. become: yes
  87. - name: Install Redis Insights
  88. get_url:
  89. url: https://downloads.redisinsight.redislabs.com/latest/redisinsight-linux64
  90. dest: /usr/local/bin/redisinsight
  91. mode: '0755'
  92. - name: Redis Insights Systemd
  93. template:
  94. src: systemd_redis_insights.j2
  95. dest: /lib/systemd/system/redis-insights.service
  96. owner: root
  97. group: root
  98. mode: 0644
  99. - name: Enable Redis Insights Services
  100. systemd:
  101. name: redis-insights
  102. enabled: yes
  103. state: started
  104. - name: Enable Redis Insights Services in Nginx
  105. template:
  106. src: nginx_insights.j2
  107. dest: /etc/nginx/sites-enabled/insights
  108. owner: root
  109. group: root
  110. mode: 0644
  111. notify:
  112. - restart_nginx
  113. - name: Enable Redis Insights Services
  114. file:
  115. path: /etc/nginx/sites-enabled/default
  116. state: absent
  117. notify:
  118. - restart_nginx
  119. - name: Add Golang PPA
  120. apt_repository:
  121. repo: 'ppa:longsleep/golang-backports'
  122. state: present
  123. - name: Install Go
  124. package:
  125. name: golang
  126. post_tasks:
  127. - name: create the redis dir
  128. file:
  129. path: /redis
  130. owner: redis
  131. group: redis
  132. mode: '0755'
  133. state: directory