mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	Merge pull request #356 from jvonau/avoid-dups
sync from jvonau:avoid-dups
This commit is contained in:
		
						commit
						f68fdb6cb8
					
				
					 8 changed files with 39 additions and 42 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
- name: Enable postgresql-iiab service when moodle_enabled
 | 
			
		||||
- name: Enable 'postgresql-iiab' systemd service, if moodle_enabled
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: postgresql-iiab
 | 
			
		||||
    state: started
 | 
			
		||||
| 
						 | 
				
			
			@ -6,7 +6,7 @@
 | 
			
		|||
  when: moodle_enabled
 | 
			
		||||
 | 
			
		||||
# if the only service using the backend db disable if not running
 | 
			
		||||
- name: Disable postgresql-iiab service when not moodle_enabled
 | 
			
		||||
- name: Disable 'postgresql-iiab' systemd service, if not moodle_enabled and not (pathagar_enabled is defined and pathagar_enabled)
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: postgresql-iiab
 | 
			
		||||
    state: stopped
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +23,7 @@
 | 
			
		|||
  command: a2dissite 022-moodle.conf
 | 
			
		||||
  when: apache_install and not moodle_enabled
 | 
			
		||||
 | 
			
		||||
- name: Restart Apache systemd service ({{ apache_service }})
 | 
			
		||||
- name: Restart '{{ apache_service }}' systemd service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: "{{ apache_service }}"    # apache2 or httpd, as set in /opt/iiab/iiab/vars/<OS>.yml
 | 
			
		||||
    state: restarted
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
- name: Turn on enabled vars for PostgreSQL
 | 
			
		||||
- name: "Set PostgreSQL vars 'postgresql_install: True' and 'postgresql_enabled: True'"
 | 
			
		||||
  set_fact:
 | 
			
		||||
    postgresql_install: True
 | 
			
		||||
    postgresql_enabled: True
 | 
			
		||||
 | 
			
		||||
- name: POSTGRESQL
 | 
			
		||||
- name: POSTGRESQL - run the 'postgresql' role
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: postgresql
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,6 @@
 | 
			
		|||
      - php{{ php_version }}-xmlrpc
 | 
			
		||||
    state: present
 | 
			
		||||
  when: is_debuntu | bool
 | 
			
		||||
  #tags: download
 | 
			
		||||
 | 
			
		||||
- name: Install php{{ php_version }}-xml (ubuntu or debian 9+)
 | 
			
		||||
  package:
 | 
			
		||||
| 
						 | 
				
			
			@ -44,15 +43,12 @@
 | 
			
		|||
      - php-xmlrpc
 | 
			
		||||
    state: present
 | 
			
		||||
  when: not is_debuntu
 | 
			
		||||
  #tags: download
 | 
			
		||||
 | 
			
		||||
- include_tasks: centos.yml
 | 
			
		||||
  when: ansible_distribution == "CentOS"
 | 
			
		||||
  #tags: download
 | 
			
		||||
 | 
			
		||||
- include_tasks: fedora.yml
 | 
			
		||||
  when: ansible_distribution == "Fedora"
 | 
			
		||||
  #tags: download
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# 2019-07-03 @jvonau @holta: the next 50 lines (6 stanzas) double MariaDB's
 | 
			
		||||
| 
						 | 
				
			
			@ -68,7 +64,7 @@
 | 
			
		|||
- name: Copy pkg's /lib/systemd/system/mariadb.service to /etc/systemd/system/ to be customized (CREATES TIMESTAMPED BACKUPS OF /etc/systemd/system/mariadb.service e.g. IF OPERATOR CUSTOMIZED IT, EVEN DESPITE WARNING BELOW!)
 | 
			
		||||
  copy:
 | 
			
		||||
    force: yes
 | 
			
		||||
    backup: no
 | 
			
		||||
    backup: yes
 | 
			
		||||
    src: /lib/systemd/system/mariadb.service
 | 
			
		||||
    dest: /etc/systemd/system/
 | 
			
		||||
  when: mariadb_unit_file.stat.exists
 | 
			
		||||
| 
						 | 
				
			
			@ -178,6 +174,7 @@
 | 
			
		|||
    state: stopped
 | 
			
		||||
  when: not mysql_enabled
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
- name: Add 'mysql' variable values to {{ iiab_ini_file }}
 | 
			
		||||
  ini_file:
 | 
			
		||||
    path: "{{ iiab_ini_file }}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
# 2019-01-16: @jvonau's PR #1403 moved installation of Node.js (8.x for now) &
 | 
			
		||||
# npm to roles/nodejs/tasks/main.yml
 | 
			
		||||
 | 
			
		||||
- name: NODEJS
 | 
			
		||||
- name: NODEJS - run the 'nodejs' role
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: nodejs
 | 
			
		||||
# 2020-01-04 no longer triggered by roles/nodered/meta/main.yml
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,9 @@
 | 
			
		|||
- name: Turn on enabled vars for PostgreSQL
 | 
			
		||||
- name: "Set PostgreSQL vars 'postgresql_install: True' and 'postgresql_enabled: True'"
 | 
			
		||||
  set_fact:
 | 
			
		||||
    postgresql_install: True
 | 
			
		||||
    postgresql_enabled: True
 | 
			
		||||
 | 
			
		||||
- name: POSTGRESQL
 | 
			
		||||
- name: POSTGRESQL - run the 'postgresql' role
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: postgresql
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -12,7 +12,7 @@
 | 
			
		|||
    name: pathagar
 | 
			
		||||
    state: absent
 | 
			
		||||
 | 
			
		||||
- name: Install Pathagar prerequisites (all OSs)
 | 
			
		||||
- name: "Install Pathagar prerequisites: python-virtualenv, python-pip, python-psycopg2"
 | 
			
		||||
  package:
 | 
			
		||||
    name: "{{ item }}"
 | 
			
		||||
    state: present
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +21,7 @@
 | 
			
		|||
    - python-pip
 | 
			
		||||
    - python-psycopg2
 | 
			
		||||
 | 
			
		||||
- name: Install Pathagar prerequisites (debuntu)
 | 
			
		||||
- name: "Install Pathagar prerequisites: libapache2-mod-wsgi, libxml2-dev, libxslt-dev (debuntu)"
 | 
			
		||||
  package:
 | 
			
		||||
    name: "{{ item }}"
 | 
			
		||||
    state: present
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +31,7 @@
 | 
			
		|||
    - libxslt-dev
 | 
			
		||||
  when: is_debuntu | bool
 | 
			
		||||
 | 
			
		||||
- name: Install Pathagar prerequisites (not debuntu)
 | 
			
		||||
- name: "Install Pathagar prerequisites: mod_wsgi, libxml2-devel, libxslt-devel (not debuntu)"
 | 
			
		||||
  package:
 | 
			
		||||
    name: "{{ item }}"
 | 
			
		||||
    state: present
 | 
			
		||||
| 
						 | 
				
			
			@ -41,21 +41,21 @@
 | 
			
		|||
    - libxslt-devel
 | 
			
		||||
  when: not is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Create destination folder
 | 
			
		||||
- name: "Create destination folder: {{ pathagar_src }}"
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ pathagar_src }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0755
 | 
			
		||||
    # owner: root
 | 
			
		||||
    # group: root
 | 
			
		||||
    # mode: '0755'
 | 
			
		||||
 | 
			
		||||
- name: Create books destination folder
 | 
			
		||||
- name: "Create books destination folder: {{ pathagar_media }}"
 | 
			
		||||
  file:
 | 
			
		||||
    path: "{{ pathagar_media }}"
 | 
			
		||||
    state: directory
 | 
			
		||||
    owner: "{{ apache_user }}"
 | 
			
		||||
    group: "{{ apache_user }}"
 | 
			
		||||
    mode: 0755
 | 
			
		||||
    mode: '0755'
 | 
			
		||||
 | 
			
		||||
- name: Determine if Pathagar has already been downloaded from git
 | 
			
		||||
  stat:
 | 
			
		||||
| 
						 | 
				
			
			@ -98,8 +98,8 @@
 | 
			
		|||
  become: yes
 | 
			
		||||
  become_user: postgres
 | 
			
		||||
 | 
			
		||||
- name: Start postgresql-iiab
 | 
			
		||||
  service:
 | 
			
		||||
- name: Start 'postgresql-iiab' systemd service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: postgresql-iiab
 | 
			
		||||
    state: started
 | 
			
		||||
    enabled: yes
 | 
			
		||||
| 
						 | 
				
			
			@ -117,8 +117,8 @@
 | 
			
		|||
    group: postgres
 | 
			
		||||
  register: enable_pathagar_md5_access
 | 
			
		||||
 | 
			
		||||
- name: Reload postgresql service
 | 
			
		||||
  service:
 | 
			
		||||
- name: Reload 'postgresql-iiab' systemd service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: postgresql-iiab
 | 
			
		||||
    state: reloaded
 | 
			
		||||
  when: enable_pathagar_md5_access.changed
 | 
			
		||||
| 
						 | 
				
			
			@ -137,9 +137,9 @@
 | 
			
		|||
  template:
 | 
			
		||||
    src: prod_settings.py
 | 
			
		||||
    dest: "{{ pathagar_src }}/prod_settings.py"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0644
 | 
			
		||||
    # owner: root
 | 
			
		||||
    # group: root
 | 
			
		||||
    # mode: '0644'
 | 
			
		||||
 | 
			
		||||
- name: Create Pathagar initial db
 | 
			
		||||
  django_manage:
 | 
			
		||||
| 
						 | 
				
			
			@ -154,7 +154,7 @@
 | 
			
		|||
    dest: "{{ pathagar_dir }}/auth.User.json"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0600
 | 
			
		||||
    mode: '0600'
 | 
			
		||||
 | 
			
		||||
- name: Load Pathagar admin user
 | 
			
		||||
  django_manage:
 | 
			
		||||
| 
						 | 
				
			
			@ -175,37 +175,37 @@
 | 
			
		|||
  template:
 | 
			
		||||
    src: wsgi.py
 | 
			
		||||
    dest: "{{ pathagar_dir }}/wsgi.py"
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
    mode: 0644
 | 
			
		||||
    # owner: root
 | 
			
		||||
    # group: root
 | 
			
		||||
    # mode: '0644'
 | 
			
		||||
 | 
			
		||||
- name: Install httpd conf for Pathagar
 | 
			
		||||
- name: Install /etc/{{ apache_config_dir }}/pathagar.conf from template
 | 
			
		||||
  template:
 | 
			
		||||
    src: pathagar.conf
 | 
			
		||||
    backup: yes
 | 
			
		||||
    dest: "/etc/{{ apache_config_dir }}/pathagar.conf"
 | 
			
		||||
    mode: 0644
 | 
			
		||||
 | 
			
		||||
- name: Enable Pathagar (debuntu)
 | 
			
		||||
- name: Enable Pathagar via Apache (debuntu)
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/apache2/sites-enabled/pathagar.conf
 | 
			
		||||
    src: /etc/apache2/sites-available/pathagar.conf
 | 
			
		||||
    state: link
 | 
			
		||||
  when: pathagar_enabled and is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Disable Pathagar (debuntu)
 | 
			
		||||
- name: Disable Pathagar via Apache (debuntu)
 | 
			
		||||
  file:
 | 
			
		||||
    path: /etc/apache2/sites-enabled/pathagar.conf
 | 
			
		||||
    state: absent
 | 
			
		||||
  when: not pathagar_enabled and is_debuntu
 | 
			
		||||
 | 
			
		||||
- name: Reload Apache ({{ apache_service }})
 | 
			
		||||
- name: Reload '{{ apache_service }}' systemd service
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: "{{ apache_service }}"
 | 
			
		||||
    state: reloaded
 | 
			
		||||
 | 
			
		||||
# if the only service using the backend db disable if not running
 | 
			
		||||
- name: Disable postgresql-iiab service when not pathagar_enabled
 | 
			
		||||
- name: Disable 'postgresql-iiab' systemd service, if not moodle_enabled and not pathagar_enabled
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: postgresql-iiab
 | 
			
		||||
    state: stopped
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
- name: NODEJS
 | 
			
		||||
- name: NODEJS - run the 'nodejs' role
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: nodejs
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
  when: not sugarizer_enabled
 | 
			
		||||
 | 
			
		||||
# stops mongodb would of been called via meta/main.yml prior
 | 
			
		||||
- name: MONGODB
 | 
			
		||||
- name: Run mongodb/tasks/enable.yml to stop MongoDB, if not sugarizer_enabled
 | 
			
		||||
  include_tasks: roles/mongodb/tasks/enable.yml
 | 
			
		||||
  when: not sugarizer_enabled
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,8 @@
 | 
			
		|||
- name: MONGODB
 | 
			
		||||
- name: MONGODB - run the 'mongodb' role
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: mongodb
 | 
			
		||||
 | 
			
		||||
- name: NODEJS
 | 
			
		||||
- name: NODEJS - run the 'nodejs' role
 | 
			
		||||
  include_role:
 | 
			
		||||
    name: nodejs
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue