CentOS.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. ---
  2. # CentOS related tasks
  3. - name: Prep OS... Check web server installed
  4. shell: "httpd -v"
  5. register: web_apache
  6. ignore_errors: yes
  7. - name: Prep OS... Check nginx installed
  8. shell: "nginx -v"
  9. register: web_nginx
  10. ignore_errors: yes
  11. when: web_apache.stderr | length > 0
  12. - name: Prep OS... Set nextcloud_websrv variable
  13. set_fact:
  14. nextcloud_websrv: "apache"
  15. - name: Prep OS... Set nextcloud_websrv variable
  16. set_fact:
  17. nextcloud_websrv: "nginx"
  18. when: web_apache.stderr | length > 0
  19. - name: Prep OS... display web server
  20. debug: var=nextcloud_websrv
  21. #- name: Prep OS... Create tmp directory
  22. # file:
  23. # path: "{{ item }}"
  24. # state: directory
  25. # owner: "{{ ansible_user }}"
  26. # mode: 0770
  27. # with_items:
  28. # - "/tmp/ansible_{{ ansible_user }}"
  29. #
  30. #- name: Prep OS... Set remote tmp
  31. # set_fact:
  32. # ansible_remote_tmp: "/tmp/ansible_{{ ansible_user }}"
  33. - name: Prep OS... add rpmfusion-free-release centos{{ ansible_distribution_major_version|int }} repo
  34. dnf:
  35. name: https://download1.rpmfusion.org/free/el/rpmfusion-free-release-{{ ansible_distribution_major_version|int }}.noarch.rpm
  36. disable_gpg_check: yes
  37. validate_certs: no
  38. state: latest
  39. - name: Prep OS... import key from Collabora centos{{ ansible_distribution_major_version|int }} repo
  40. ansible.builtin.rpm_key:
  41. state: present
  42. key: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-centos{{ ansible_distribution_major_version|int }}/repodata/repomd.xml.key
  43. when: nc_collabora
  44. - name: Prep OS... add Collabora repos centos{{ ansible_distribution_major_version|int }} repo
  45. ansible.builtin.yum_repository:
  46. name: collabora
  47. description: Collabora Online CODE repo
  48. baseurl: https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-centos{{ ansible_distribution_major_version|int }}
  49. when: nc_collabora
  50. - name: Prep OS... update os
  51. dnf:
  52. name: '*'
  53. update_cache: true
  54. state: latest
  55. - name: Prep OS... install Collabora packages
  56. dnf:
  57. name:
  58. - coolwsd
  59. - CODE-brand
  60. - inotify-tools
  61. - psmisc
  62. - perl
  63. state: latest
  64. when: nc_collabora
  65. - name: Prep OS... install needed packages
  66. dnf:
  67. name:
  68. - libreoffice
  69. - ffmpeg
  70. state: latest
  71. enablerepo: epel
  72. - name: Prep OS... Set http env on {{ ansible_facts['distribution'] }}
  73. set_fact:
  74. http_service_name: httpd
  75. http_webroot: /var/www/html
  76. nextcloud_websrv_user: apache
  77. nextcloud_websrv_group: apache
  78. when: nextcloud_websrv in ["apache", "apache2"]
  79. - name: Prep OS... Get httpd version
  80. shell: "httpd -v | head -n1 | cut -d'/' -f2 | cut -d' ' -f1"
  81. register: web_version
  82. when: nextcloud_websrv in ["apache", "apache2"]
  83. - name: Prep OS... Get SSL version
  84. shell: "openssl version | cut -d' ' -f2 | cut -d'-' -f1"
  85. register: ssl_version
  86. - name: Prep OS... Set web and SSL status
  87. set_fact:
  88. web_status: "{{ web_version.stdout|string is version('2.4.8', '>=') }}"
  89. ssl_status: "{{ ssl_version.stdout|string is version('1.1.1', '>') }}"
  90. - name: Prep OS... Set php env for {{ ansible_facts['distribution'] }}
  91. set_fact:
  92. php_bin: /usr/bin/php
  93. #php_dir: "/etc/opt/remi/php{{ php_version | replace('.','') }}/php.d"
  94. - include_tasks: "ssl.yml"
  95. - name: Prep OS... Generate Nextcloud configuration for apache
  96. template:
  97. dest: /etc/httpd/conf.d/nextcloud.conf
  98. src: apache2_nc_conf.j2
  99. #src: apache2_nc_conf_old.j2
  100. mode: 0640
  101. when: nextcloud_websrv in ["apache", "apache2"]
  102. - name: Prep OS... Install glusterFS client
  103. dnf:
  104. name: glusterfs-fuse
  105. state: latest
  106. when: (groups['web_servers'] | length) > 1