Role haproxy_server for OpenStack-Ansible
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

haproxy_pre_install.yml 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ---
  2. # Copyright 2015, Rackspace US, Inc.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # NOTE(cloudnull):
  16. # While the haproxy distro packages provide for an haproxy
  17. # group this group is being created upfront to support
  18. # log aggregation links as well as ensure common user
  19. # functionality across various distros that we support.
  20. - name: Create the haproxy system group
  21. group:
  22. name: "haproxy"
  23. state: "present"
  24. system: "yes"
  25. tags:
  26. - haproxy-group
  27. # NOTE(cloudnull):
  28. # While the haproxy distro packages provide for an haproxy
  29. # user this user is being created upfront to support
  30. # log aggregation links as well as ensure common user
  31. # functionality across various distros that we support.
  32. - name: Create the haproxy system user
  33. user:
  34. name: "haproxy"
  35. group: "haproxy"
  36. comment: "haproxy user"
  37. shell: "/bin/false"
  38. system: "yes"
  39. createhome: "yes"
  40. home: "/var/lib/haproxy"
  41. tags:
  42. - haproxy-user
  43. - name: create the system group
  44. group:
  45. name: "adm"
  46. state: "present"
  47. system: "yes"
  48. tags:
  49. - haproxy-dirs
  50. - haproxy-logs
  51. - name: Create haproxy log dir
  52. file:
  53. path: "{{ '/var/log/haproxy' | realpath }}"
  54. state: directory
  55. owner: haproxy
  56. group: adm
  57. mode: "0755"
  58. tags:
  59. - haproxy-dirs
  60. - haproxy-logs
  61. - name: Remove conflicting distro packages
  62. package:
  63. name: "{{ haproxy_distro_packages_remove }}"
  64. state: absent
  65. - name: Create haproxy conf.d dir
  66. file:
  67. path: "/etc/haproxy/conf.d"
  68. state: directory
  69. mode: "0755"
  70. - name: Remove old config files
  71. file:
  72. path: "{{ item }}"
  73. state: absent
  74. with_items:
  75. - "{{ haproxy_remove_files }}"
  76. when:
  77. - ansible_pkg_mgr == 'apt'